kpilot
mal-factory.ccGo to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include "options.h"
00009
00010 #include <kapplication.h>
00011 #include <kinstance.h>
00012 #include <kaboutdata.h>
00013
00014 #include <time.h>
00015 #include "mal-conduit.h"
00016 #include "mal-setup.h"
00017
00018 #include "mal-factory.moc"
00019
00020
00021 extern "C"
00022 {
00023
00024 void *init_libmalconduit()
00025 {
00026 return new MALConduitFactory;
00027 }
00028
00029 } ;
00030
00031
00032
00033 KAboutData *MALConduitFactory::fAbout = 0L;
00034 const char *MALConduitFactory::fGroup = "MAL-conduit";
00035 const char *MALConduitFactory::fLastSync = "Last MAL Sync";
00036 const char *MALConduitFactory::fSyncTime = "Sync Frequency";
00037 const char *MALConduitFactory::fProxyType = "Proxy Type";
00038 const char *MALConduitFactory::fProxyServer = "Proxy Server";
00039 const char *MALConduitFactory::fProxyPort = "Proxy Port";
00040 const char *MALConduitFactory::fProxyUser = "Proxy User";
00041 const char *MALConduitFactory::fProxyPassword = "Proxy Password";
00042
00043 MALConduitFactory::MALConduitFactory(QObject *p, const char *n) :
00044 KLibFactory(p,n)
00045 {
00046 FUNCTIONSETUP;
00047
00048 fInstance = new KInstance("MALconduit");
00049 fAbout = new KAboutData("MALconduit",
00050 I18N_NOOP("MAL Synchronization Conduit for KPilot"),
00051 KPILOT_VERSION,
00052 I18N_NOOP("Synchronizes the content from MAL Servers like AvantGo to the Handheld"),
00053 KAboutData::License_GPL,
00054 "(C) 2002, Reinhold Kainhofer");
00055 fAbout->addAuthor("Reinhold Kainhofer",
00056 I18N_NOOP("Primary Author"), "reinhold@kainhofer.com", "http://reinhold.kainhofer.com/");
00057 fAbout->addAuthor("Jason Day",
00058 I18N_NOOP("Author of libmal and the JPilot AvantGo conduit"), "jasonday@worldnet.att.net");
00059 fAbout->addAuthor("Tom Whittaker",
00060 I18N_NOOP("Author of syncmal"), "tom@tomw.org", "http://www.tomw.org/");
00061 fAbout->addAuthor("AvantGo, Inc.",
00062 I18N_NOOP("Authors of the malsync library (c) 1997-1999"), "www.avantgo.com", "http://www.avantgo.com/");
00063 }
00064
00065 MALConduitFactory::~MALConduitFactory()
00066 {
00067 FUNCTIONSETUP;
00068
00069 KPILOT_DELETE(fInstance);
00070 KPILOT_DELETE(fAbout);
00071 }
00072
00073 QObject *MALConduitFactory::createObject( QObject *p,
00074 const char *n,
00075 const char *c,
00076 const QStringList &a)
00077 {
00078 FUNCTIONSETUP;
00079
00080 #ifdef DEBUG
00081 DEBUGKPILOT << fname
00082 << ": Creating object of class "
00083 << c
00084 << endl;
00085 #endif
00086
00087 if (qstrcmp(c,"ConduitConfig")==0)
00088 {
00089 QWidget *w = dynamic_cast<QWidget *>(p);
00090
00091 if (w)
00092 {
00093 return new MALWidgetSetup(w,n,a);
00094 }
00095 else
00096 {
00097 kdError() << k_funcinfo
00098 << ": Couldn't cast parent to widget."
00099 << endl;
00100 return 0L;
00101 }
00102 }
00103
00104 if (qstrcmp(c,"SyncAction")==0)
00105 {
00106 KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
00107
00108 if (d)
00109 {
00110 return new MALConduit(d,n,a);
00111 }
00112 else
00113 {
00114 kdError() << k_funcinfo
00115 << ": Couldn't cast parent to KPilotDeviceLink"
00116 << endl;
00117 return 0L;
00118 }
00119 }
00120
00121 return 0L;
00122 }
00123
|