popmail-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 <qtabwidget.h>
00032 #include <qlineedit.h>
00033
00034 #include <kconfig.h>
00035 #include <kinstance.h>
00036 #include <kaboutdata.h>
00037
00038 #include "setupDialog.h"
00039 #include "popmail-conduit.h"
00040 #include "popmail-factory.moc"
00041
00042
00043 extern "C"
00044 {
00045
00046 void *init_conduit_popmail()
00047 {
00048 return new PopMailConduitFactory;
00049 }
00050
00051 }
00052
00053
00054 const char * const PopMailConduitFactory::fGroup = "Popmail-conduit" ;
00055 const char * const PopMailConduitFactory::fSyncIncoming = "SyncIncoming" ;
00056 const char * const PopMailConduitFactory::fSyncOutgoing = "SyncOutgoing" ;
00057
00058 KAboutData *PopMailConduitFactory::fAbout = 0L;
00059 PopMailConduitFactory::PopMailConduitFactory(QObject *p, const char *n) :
00060 KLibFactory(p,n)
00061 {
00062 FUNCTIONSETUP;
00063
00064 fInstance = new KInstance("popmailconduit");
00065 fAbout = new KAboutData("popmailConduit",
00066 I18N_NOOP("Mail Conduit for KPilot"),
00067 KPILOT_VERSION,
00068 I18N_NOOP("Configures the Mail Conduit for KPilot"),
00069 KAboutData::License_GPL,
00070 "(C) 2001, Dan Pilone, Michael Kropfberger, Adriaan de Groot");
00071 fAbout->addAuthor("Adriaan de Groot",
00072 I18N_NOOP("Maintainer"),
00073 "groot@kde.org",
00074 "http://www.cs.kun.nl/~adridg/kpilot");
00075 fAbout->addAuthor("Dan Pilone",
00076 I18N_NOOP("Original Author"));
00077 fAbout->addCredit("Michael Kropfberger",
00078 I18N_NOOP("POP3 code"));
00079 fAbout->addCredit("Marko Grönroos",
00080 I18N_NOOP("SMTP support and redesign"),
00081 "magi@iki.fi",
00082 "http://www/iki.fi/magi/");
00083 }
00084
00085 PopMailConduitFactory::~PopMailConduitFactory()
00086 {
00087 FUNCTIONSETUP;
00088
00089 KPILOT_DELETE(fInstance);
00090 KPILOT_DELETE(fAbout);
00091 }
00092
00093 QObject *PopMailConduitFactory::createObject( QObject *p,
00094 const char *n,
00095 const char *c,
00096 const QStringList &a)
00097 {
00098 FUNCTIONSETUP;
00099
00100 #ifdef DEBUG
00101 DEBUGCONDUIT << fname
00102 << ": Creating object of class "
00103 << c
00104 << endl;
00105 #endif
00106
00107 if (qstrcmp(c,"ConduitConfigBase")==0)
00108 {
00109 QWidget *w = dynamic_cast<QWidget *>(p);
00110
00111 if (w)
00112 {
00113 return new PopMailWidgetConfig(w,n);
00114 }
00115 else
00116 {
00117 #ifdef DEBUG
00118 DEBUGCONDUIT << fname
00119 << ": Couldn't cast parent to widget."
00120 << endl;
00121 #endif
00122 return 0L;
00123 }
00124 }
00125
00126 if (qstrcmp(c,"ConduitConfig")==0)
00127 {
00128 QWidget *w = dynamic_cast<QWidget *>(p);
00129
00130 if (w)
00131 {
00132 return new ConduitConfigImplementation(w,n,a,
00133 PopMailWidgetConfig::create);
00134 }
00135 else
00136 {
00137 #ifdef DEBUG
00138 DEBUGCONDUIT << fname
00139 << ": Couldn't cast parent to widget."
00140 << endl;
00141 #endif
00142 return 0L;
00143 }
00144 }
00145
00146
00147 if (qstrcmp(c,"SyncAction")==0)
00148 {
00149 KPilotDeviceLink *d = dynamic_cast<KPilotDeviceLink *>(p);
00150
00151 if (d)
00152 {
00153 return new PopMailConduit(d,n,a);
00154 }
00155 else
00156 {
00157 kdError() << k_funcinfo
00158 << ": Couldn't cast to KPilotDeviceLink"
00159 << endl;
00160 return 0L;
00161 }
00162 }
00163 return 0L;
00164 }
00165
00166 #if 0
00167 PopmailWidgetSetup::PopmailWidgetSetup(QWidget *w, const char *n,
00168 const QStringList & a) :
00169 ConduitConfig(w,n,a)
00170 {
00171 FUNCTIONSETUP;
00172
00173 QTabWidget *t = new QTabWidget(widget());
00174 fSendPage = new PopMailSendPage(t);
00175 t->addTab(fSendPage,i18n("Send Mail"));
00176 fRecvPage = new PopMailReceivePage(t);
00177 t->addTab(fRecvPage,i18n("Retrieve Mail"));
00178
00179 setTabWidget(t);
00180 addAboutPage(false,PopMailConduitFactory::about());
00181
00182 t->adjustSize();
00183 fConduitName=i18n("POP/Mail");
00184 }
00185
00186 PopmailWidgetSetup::~PopmailWidgetSetup()
00187 {
00188 FUNCTIONSETUP;
00189 }
00190
00191 void PopmailWidgetSetup::commitChanges()
00192 {
00193 FUNCTIONSETUP;
00194
00195 if (!fConfig) return;
00196
00197 KConfigGroupSaver s(fConfig,PopMailConduitFactory::group);
00198
00199 fSendPage->commitChanges(*fConfig);
00200 fRecvPage->commitChanges(*fConfig);
00201 }
00202
00203 void PopmailWidgetSetup::readSettings()
00204 {
00205 FUNCTIONSETUP;
00206
00207 if (!fConfig) return;
00208
00209 KConfigGroupSaver s(fConfig,PopMailConduitFactory::group);
00210
00211 fSendPage->readSettings(*fConfig);
00212 fRecvPage->readSettings(*fConfig);
00213 }
00214
00215 #endif
This file is part of the documentation for kpilot Library Version 3.2.2.