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_conduit_time()
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,"ConduitConfigBase")==0)
00101 {
00102 QWidget *w = dynamic_cast<QWidget *>(p);
00103 if (w)
00104 {
00105 return new TimeWidgetConfig(w,"ConduitConfigBase");
00106 }
00107 else
00108 {
00109 return 0L;
00110 }
00111 }
00112 else
00113 if (qstrcmp(c,"ConduitConfig")==0)
00114 {
00115 QWidget *w = dynamic_cast<QWidget *>(p);
00116
00117 if (w)
00118 {
00119 return new TimeWidgetSetup(w,n,a);
00120 }
00121 else
00122 {
00123 kdError() << k_funcinfo
00124 << ": Couldn't cast parent to widget."
00125 << endl;
00126 return 0L;
00127 }
00128 }
00129
00130 if (qstrcmp(c,"SyncAction")==0)
00131 {
00132 KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
00133
00134 if (d)
00135 {
00136 return new TimeConduit(d,n,a);
00137 }
00138 else
00139 {
00140 kdError() << k_funcinfo
00141 << ": Couldn't cast parent to KPilotDeviceLink"
00142 << endl;
00143 return 0L;
00144 }
00145 }
00146
00147 return 0L;
00148 }
00149
This file is part of the documentation for kpilot Library Version 3.2.2.