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 /* 00009 ** This program is free software; you can redistribute it and/or modify 00010 ** it under the terms of the GNU General Public License as published by 00011 ** the Free Software Foundation; either version 2 of the License, or 00012 ** (at your option) any later version. 00013 ** 00014 ** This program is distributed in the hope that it will be useful, 00015 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 ** GNU General Public License for more details. 00018 ** 00019 ** You should have received a copy of the GNU General Public License 00020 ** along with this program in a file called COPYING; if not, write to 00021 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00022 ** MA 02111-1307, USA. 00023 ** 00024 ** 00025 ** Specific permission is granted for this code to be linked to libmal 00026 ** (this is necessary because the libmal license is not GPL-compatible). 00027 */ 00028 00029 /* 00030 ** Bug reports and questions can be sent to kde-pim@kde.org 00031 */ 00032 00033 #include "options.h" 00034 00035 #include <kapplication.h> 00036 #include <kinstance.h> 00037 #include <kaboutdata.h> 00038 00039 #include <time.h> // Needed by pilot-link include 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 // A number of static variables; except for fAbout, they're 00058 // all KConfig group or entry keys. 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 /* virtual */ 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
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