mal-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
00030
00031
00032
00033 #include "options.h"
00034
00035 #include <kapplication.h>
00036 #include <kinstance.h>
00037 #include <kaboutdata.h>
00038
00039 #include <time.h>
00040 #include "mal-conduit.h"
00041 #include "mal-setup.h"
00042
00043 #include "mal-factory.moc"
00044
00045
00046 extern "C"
00047 {
00048
00049 void *init_conduit_mal()
00050 {
00051 return new MALConduitFactory;
00052 }
00053
00054 }
00055
00056
00057
00058
00059
00060
00061 KAboutData *MALConduitFactory::fAbout = 0L;
00062 const char *MALConduitFactory::fGroup = "MAL-conduit";
00063 const char *MALConduitFactory::fLastSync = "Last MAL Sync";
00064 const char *MALConduitFactory::fSyncTime = "Sync Frequency";
00065 const char *MALConduitFactory::fProxyType = "Proxy Type";
00066 const char *MALConduitFactory::fProxyServer = "Proxy Server";
00067 const char *MALConduitFactory::fProxyPort = "Proxy Port";
00068 const char *MALConduitFactory::fProxyUser = "Proxy User";
00069 const char *MALConduitFactory::fProxyPassword = "Proxy Password";
00070 const char *MALConduitFactory::fMALServer = "MAL Server";
00071 const char *MALConduitFactory::fMALPort = "MAL Port";
00072 const char *MALConduitFactory::fMALUser = "MAL User";
00073 const char *MALConduitFactory::fMALPassword = "Proxy Password";
00074
00075 MALConduitFactory::MALConduitFactory(QObject *p, const char *n) :
00076 KLibFactory(p,n)
00077 {
00078 FUNCTIONSETUP;
00079
00080 fInstance = new KInstance("MALconduit");
00081 fAbout = new KAboutData("MALconduit",
00082 I18N_NOOP("MAL Synchronization Conduit for KPilot"),
00083 KPILOT_VERSION,
00084 I18N_NOOP("Synchronizes the content from MAL Servers like AvantGo to the Handheld"),
00085 KAboutData::License_GPL,
00086 "(C) 2002, Reinhold Kainhofer");
00087 fAbout->addAuthor("Reinhold Kainhofer",
00088 I18N_NOOP("Primary Author"), "reinhold@kainhofer.com", "http://reinhold.kainhofer.com/");
00089 fAbout->addCredit("Jason Day",
00090 I18N_NOOP("Author of libmal and the JPilot AvantGo conduit"), "jasonday@worldnet.att.net");
00091 fAbout->addCredit("Tom Whittaker",
00092 I18N_NOOP("Author of syncmal"), "tom@tomw.org", "http://www.tomw.org/");
00093 fAbout->addCredit("AvantGo, Inc.",
00094 I18N_NOOP("Authors of the malsync library (c) 1997-1999"), "", "http://www.avantgo.com/");
00095 }
00096
00097 MALConduitFactory::~MALConduitFactory()
00098 {
00099 FUNCTIONSETUP;
00100
00101 KPILOT_DELETE(fInstance);
00102 KPILOT_DELETE(fAbout);
00103 }
00104
00105 QObject *MALConduitFactory::createObject( QObject *p,
00106 const char *n,
00107 const char *c,
00108 const QStringList &a)
00109 {
00110 FUNCTIONSETUP;
00111
00112 #ifdef DEBUG
00113 DEBUGCONDUIT << fname
00114 << ": Creating object of class "
00115 << c
00116 << endl;
00117 #endif
00118
00119 if (qstrcmp(c,"ConduitConfig")==0)
00120 {
00121 QWidget *w = dynamic_cast<QWidget *>(p);
00122
00123 if (w)
00124 {
00125 return new MALWidgetSetup(w,n,a);
00126 }
00127 else
00128 {
00129 kdError() << k_funcinfo
00130 << ": Couldn't cast parent to widget."
00131 << endl;
00132 return 0L;
00133 }
00134 }
00135
00136 if (qstrcmp(c,"SyncAction")==0)
00137 {
00138 KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
00139
00140 if (d)
00141 {
00142 return new MALConduit(d,n,a);
00143 }
00144 else
00145 {
00146 kdError() << k_funcinfo
00147 << ": Couldn't cast parent to KPilotDeviceLink"
00148 << endl;
00149 return 0L;
00150 }
00151 }
00152
00153 return 0L;
00154 }
00155
This file is part of the documentation for kpilot Library Version 3.2.2.