kpilot Library API Documentation

knotes-factory.cc

00001 /* knotes-factory.cc                      KPilot
00002 **
00003 ** Copyright (C) 2001,2003 by Dan Pilone
00004 **
00005 ** This file defines the factory for the knotes-conduit plugin.
00006 */
00007 
00008 /*
00009 ** This program is free software; you can redistribute it and/or modify
00010 ** it under the terms of the GNU General Public License as published by
00011 ** the Free Software Foundation; either version 2 of the License, or
00012 ** (at your option) any later version.
00013 **
00014 ** This program is distributed in the hope that it will be useful,
00015 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00017 ** GNU General Public License for more details.
00018 **
00019 ** You should have received a copy of the GNU General Public License
00020 ** along with this program in a file called COPYING; if not, write to
00021 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00022 ** MA 02111-1307, USA.
00023 */
00024 
00025 /*
00026 ** Bug reports and questions can be sent to kde-pim@kde.org
00027 */
00028 
00029 #include "options.h"
00030 
00031 #include <kapplication.h>
00032 #include <kinstance.h>
00033 #include <kaboutdata.h>
00034 
00035 #include <dcopclient.h>
00036 
00037 #include <time.h> // Needed by pilot-link include
00038 
00039 #include <pi-memo.h>
00040 
00041 #include "knotes-action.h"
00042 #include "knotes-setup.h"
00043 
00044 #include "knotes-factory.moc"
00045 
00046 
00047 extern "C"
00048 {
00049 
00050 void *init_conduit_knotes()
00051 {
00052     return new KNotesConduitFactory;
00053 }
00054 
00055 }
00056 
00057 
00058 /* static */ KAboutData *KNotesConduitFactory::fAbout = 0L;
00059 
00060 const char * const KNotesConduitFactory::group = "KNotes-conduit";
00061 const char * const KNotesConduitFactory::matchDeletes = "DeleteNoteForMemo";
00062 
00063 KNotesConduitFactory::KNotesConduitFactory(QObject *p, const char *n) :
00064     KLibFactory(p,n)
00065 {
00066     FUNCTIONSETUP;
00067 
00068     fInstance = new KInstance("knotesconduit");
00069     fAbout = new KAboutData("knotesconduit",
00070         I18N_NOOP("KNotes Conduit for KPilot"),
00071         KPILOT_VERSION,
00072         I18N_NOOP("Configures the KNotes Conduit for KPilot"),
00073         KAboutData::License_GPL,
00074         "(C) 2001, Adriaan de Groot");
00075     fAbout->addAuthor("Adriaan de Groot",
00076         I18N_NOOP("Primary Author"),
00077         "groot@kde.org",
00078         "http://www.cs.kun.nl/~adridg/kpilot");
00079     fAbout->addCredit("David Bishop",
00080         I18N_NOOP("UI"));
00081 }
00082 
00083 KNotesConduitFactory::~KNotesConduitFactory()
00084 {
00085     FUNCTIONSETUP;
00086 
00087     KPILOT_DELETE(fInstance);
00088     KPILOT_DELETE(fAbout);
00089 }
00090 
00091 /* virtual */ QObject *KNotesConduitFactory::createObject( QObject *p,
00092     const char *n,
00093     const char *c,
00094     const QStringList &a)
00095 {
00096     FUNCTIONSETUP;
00097 
00098 #ifdef DEBUG
00099     DEBUGCONDUIT << fname
00100         << ": Creating object of class "
00101         << c
00102         << endl;
00103 #endif
00104 
00105     if (qstrcmp(c,"ConduitConfigBase")==0)
00106     {
00107         QWidget *w = dynamic_cast<QWidget *>(p);
00108         if (w)
00109         {
00110             return new KNotesConfigBase(w,0L);
00111         }
00112         else
00113         {
00114             return 0L;
00115         }
00116     }
00117     else
00118     if (qstrcmp(c,"ConduitConfig")==0)
00119     {
00120         QWidget *w = dynamic_cast<QWidget *>(p);
00121 
00122         if (w)
00123         {
00124             return new ConduitConfigImplementation(w,n,a,
00125                 KNotesConfigBase::create);
00126         }
00127         else
00128         {
00129             kdError() << k_funcinfo
00130                 << ": Couldn't cast parent to widget."
00131                 << endl;
00132             return 0L;
00133         }
00134     }
00135 
00136     if (qstrcmp(c,"SyncAction")==0)
00137     {
00138         KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
00139 
00140         if (d)
00141         {
00142             return new KNotesAction(d,n,a);
00143         }
00144         else
00145         {
00146             kdError() << k_funcinfo
00147                 << ": Couldn't cast parent to KPilotDeviceLink"
00148                 << endl;
00149             return 0L;
00150         }
00151     }
00152 
00153     return 0L;
00154 }
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:36:47 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003