kpilot Library API Documentation

knotes-factory.cc

00001 /* knotes-factory.cc                      KPilot
00002 **
00003 ** Copyright (C) 2001 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_libknotesconduit()
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,"ConduitConfig")==0)
00106         {
00107                 QWidget *w = dynamic_cast<QWidget *>(p);
00108 
00109                 if (w)
00110                 {
00111                         return new KNotesWidgetSetup(w,n,a);
00112                 }
00113                 else
00114                 {
00115                         kdError() << k_funcinfo
00116                                 << ": Couldn't cast parent to widget."
00117                                 << endl;
00118                         return 0L;
00119                 }
00120         }
00121 
00122         if (qstrcmp(c,"SyncAction")==0)
00123         {
00124                 KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
00125 
00126                 if (d)
00127                 {
00128                         return new KNotesAction(d,n,a);
00129                 }
00130                 else
00131                 {
00132                         kdError() << k_funcinfo
00133                                 << ": Couldn't cast parent to KPilotDeviceLink"
00134                                 << endl;
00135                         return 0L;
00136                 }
00137         }
00138 
00139         return 0L;
00140 }
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:14 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001