time-factory.cc
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "options.h"
00030
00031 #include <kapplication.h>
00032 #include <kinstance.h>
00033 #include <kaboutdata.h>
00034
00035 #include <time.h>
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
00054
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 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 }
This file is part of the documentation for kdelibs Version 3.1.4.