kpilot Library API Documentation

mal-factory.cc

00001 /* Time-factory.cc KPilot 00002 ** 00003 ** Copyright (C) 2002 by Reinhold Kainhofer 00004 ** 00005 ** This file defines the factory for the MAL-conduit plugin. 00006 */ 00007 00008 #include "options.h" 00009 00010 #include <kapplication.h> 00011 #include <kinstance.h> 00012 #include <kaboutdata.h> 00013 00014 #include <time.h> // Needed by pilot-link include 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 // A number of static variables; except for fAbout, they're 00033 // all KConfig group or entry keys. 00034 // 00035 KAboutData *MALConduitFactory::fAbout = 0L; 00036 const char *MALConduitFactory::fGroup = "MAL-conduit"; 00037 const char *MALConduitFactory::fLastSync = "Last MAL Sync"; 00038 const char *MALConduitFactory::fSyncTime = "Sync Frequency"; 00039 const char *MALConduitFactory::fProxyType = "Proxy Type"; 00040 const char *MALConduitFactory::fProxyServer = "Proxy Server"; 00041 const char *MALConduitFactory::fProxyPort = "Proxy Port"; 00042 const char *MALConduitFactory::fProxyUser = "Proxy User"; 00043 const char *MALConduitFactory::fProxyPassword = "Proxy Password"; 00044 00045 MALConduitFactory::MALConduitFactory(QObject *p, const char *n) : 00046 KLibFactory(p,n) 00047 { 00048 FUNCTIONSETUP; 00049 00050 fInstance = new KInstance("MALconduit"); 00051 fAbout = new KAboutData("MALconduit", 00052 I18N_NOOP("MAL Synchronization Conduit for KPilot"), 00053 KPILOT_VERSION, 00054 I18N_NOOP("Synchronizes the content from MAL Servers like AvantGo to the Handheld"), 00055 KAboutData::License_GPL, 00056 "(C) 2002, Reinhold Kainhofer"); 00057 fAbout->addAuthor("Reinhold Kainhofer", 00058 I18N_NOOP("Primary Author"), "reinhold@kainhofer.com", "http://reinhold.kainhofer.com/"); 00059 fAbout->addAuthor("Jason Day", 00060 I18N_NOOP("Author of libmal and the JPilot AvantGo conduit"), "jasonday@worldnet.att.net"); 00061 fAbout->addAuthor("Tom Whittaker", 00062 I18N_NOOP("Author of syncmal"), "tom@tomw.org", "http://www.tomw.org/"); 00063 fAbout->addAuthor("AvantGo, Inc.", 00064 I18N_NOOP("Authors of the malsync library (c) 1997-1999"), "www.avantgo.com", "http://www.avantgo.com/"); 00065 } 00066 00067 MALConduitFactory::~MALConduitFactory() 00068 { 00069 FUNCTIONSETUP; 00070 00071 KPILOT_DELETE(fInstance); 00072 KPILOT_DELETE(fAbout); 00073 } 00074 00075 /* virtual */ QObject *MALConduitFactory::createObject( QObject *p, 00076 const char *n, 00077 const char *c, 00078 const QStringList &a) 00079 { 00080 FUNCTIONSETUP; 00081 00082 #ifdef DEBUG 00083 DEBUGCONDUIT << fname 00084 << ": Creating object of class " 00085 << c 00086 << endl; 00087 #endif 00088 00089 if (qstrcmp(c,"ConduitConfig")==0) 00090 { 00091 QWidget *w = dynamic_cast<QWidget *>(p); 00092 00093 if (w) 00094 { 00095 return new MALWidgetSetup(w,n,a); 00096 } 00097 else 00098 { 00099 kdError() << k_funcinfo 00100 << ": Couldn't cast parent to widget." 00101 << endl; 00102 return 0L; 00103 } 00104 } 00105 00106 if (qstrcmp(c,"SyncAction")==0) 00107 { 00108 KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p); 00109 00110 if (d) 00111 { 00112 return new MALConduit(d,n,a); 00113 } 00114 else 00115 { 00116 kdError() << k_funcinfo 00117 << ": Couldn't cast parent to KPilotDeviceLink" 00118 << endl; 00119 return 0L; 00120 } 00121 } 00122 00123 return 0L; 00124 } 00125
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:57:49 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003