kpilot Library API Documentation

time-factory.cc

00001 /* Time-factory.cc                      KPilot
00002 **
00003 ** Copyright (C) 2002 by Reinhold Kainhofer
00004 **
00005 ** This file defines the factory for the Time-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 <time.h> // Needed by pilot-link include
00036 #include "time-conduit.h"
00037 #include "time-setup.h"
00038 
00039 #include "time-factory.moc"
00040 
00041 
00042 extern "C"
00043 {
00044 
00045 void *init_libtimeconduit()
00046 {
00047         return new TimeConduitFactory;
00048 }
00049 
00050 } ;
00051 
00052 
00053 // A number of static variables; except for fAbout, they're 
00054 // all KConfig group or entry keys.
00055 //
00056 //
00057 KAboutData *TimeConduitFactory::fAbout = 0L;
00058 const char *TimeConduitFactory::fGroup = "Time-conduit";
00059 const char *TimeConduitFactory::fDirection = "Direction";
00060 
00061 
00062 TimeConduitFactory::TimeConduitFactory(QObject *p, const char *n) :
00063         KLibFactory(p,n)
00064 {
00065         FUNCTIONSETUP;
00066 
00067         fInstance = new KInstance("Timeconduit");
00068         fAbout = new KAboutData("Timeconduit",
00069                 I18N_NOOP("Time Synchronization Conduit for KPilot"),
00070                 KPILOT_VERSION,
00071                 I18N_NOOP("Synchronizes the Time on the Handheld and the PC"),
00072                 KAboutData::License_GPL,
00073                 "(C) 2002, Reinhold Kainhofer");
00074         fAbout->addAuthor("Reinhold Kainhofer",
00075                 I18N_NOOP("Primary Author"), "reinhold@kainhofer.com", "http://reinhold.kainhofer.com/");
00076 }
00077 
00078 TimeConduitFactory::~TimeConduitFactory()
00079 {
00080         FUNCTIONSETUP;
00081 
00082         KPILOT_DELETE(fInstance);
00083         KPILOT_DELETE(fAbout);
00084 }
00085 
00086 /* virtual */ QObject *TimeConduitFactory::createObject( QObject *p,
00087         const char *n,
00088         const char *c,
00089         const QStringList &a)
00090 {
00091         FUNCTIONSETUP;
00092 
00093 #ifdef DEBUG
00094         DEBUGCONDUIT << fname
00095                 << ": Creating object of class "
00096                 << c
00097                 << endl;
00098 #endif
00099 
00100         if (qstrcmp(c,"ConduitConfig")==0)
00101         {
00102                 QWidget *w = dynamic_cast<QWidget *>(p);
00103 
00104                 if (w)
00105                 {
00106                         return new TimeWidgetSetup(w,n,a);
00107                 }
00108                 else 
00109                 {
00110                         kdError() << k_funcinfo
00111                                 << ": Couldn't cast parent to widget."
00112                                 << endl;
00113                         return 0L;
00114                 }
00115         }
00116 
00117         if (qstrcmp(c,"SyncAction")==0)
00118         {
00119                 KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
00120 
00121                 if (d)
00122                 {
00123                         return new TimeConduit(d,n,a);
00124                 }
00125                 else
00126                 {
00127                         kdError() << k_funcinfo
00128                                 << ": Couldn't cast parent to KPilotDeviceLink"
00129                                 << endl;
00130                         return 0L;
00131                 }
00132         }
00133 
00134         return 0L;
00135 }
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:44 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001