kpilot

null-factory.cc

Go to the documentation of this file.
00001 /* KPilot
00002 **
00003 ** Copyright (C) 2001 by Dan Pilone
00004 **
00005 ** This file defines the factory for the null-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 Lesser General Public License as published by
00011 ** the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
00018 **
00019 ** You should have received a copy of the GNU Lesser General Public License
00020 ** along with this program in a file called COPYING; if not, write to
00021 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00022 ** MA 02110-1301, USA.
00023 */
00024 
00025 /*
00026 ** Bug reports and questions can be sent to kde-pim@kde.org
00027 */
00028 
00029 #include "options.h"
00030 
00031 #include <qtabwidget.h>
00032 #include <qlineedit.h>
00033 #include <qcheckbox.h>
00034 
00035 #include <kconfig.h>
00036 #include <kinstance.h>
00037 #include <kaboutdata.h>
00038 
00039 #include "pluginfactory.h"
00040 
00041 #include "setup_base.h"
00042 #include "null-conduit.h"
00043 #include "null-factory.h"
00044 #include "nullSettings.h"
00045 
00046 
00047 class NullConduitConfig : public ConduitConfigBase
00048 {
00049 public:
00050     NullConduitConfig(QWidget *parent=0L, const char *n=0L);
00051     virtual void commit();
00052     virtual void load();
00053 protected:
00054     NullWidget *fConfigWidget;
00055     KAboutData *fAbout;
00056 } ;
00057 
00058 NullConduitConfig::NullConduitConfig(QWidget *p, const char *n) :
00059     ConduitConfigBase(p,n),
00060     fConfigWidget(new NullWidget(p))
00061 {
00062     FUNCTIONSETUP;
00063     fConduitName = i18n("Null");
00064     fAbout = new KAboutData("nullConduit",
00065         I18N_NOOP("Null Conduit for KPilot"),
00066         KPILOT_VERSION,
00067         I18N_NOOP("Configures the Null Conduit for KPilot"),
00068         KAboutData::License_GPL,
00069         "(C) 2001, Adriaan de Groot");
00070     fAbout->addAuthor("Adriaan de Groot",
00071         I18N_NOOP("Primary Author"),
00072         "groot@kde.org",
00073         "http://www.cs.kun.nl/~adridg/kpilot");
00074 
00075     ConduitConfigBase::addAboutPage(fConfigWidget->tabWidget,fAbout);
00076     fWidget=fConfigWidget;
00077     QObject::connect(fConfigWidget->fLogMessage,SIGNAL(textChanged(const QString&)),
00078         this,SLOT(modified()));
00079 }
00080 
00081 /* virtual */ void NullConduitConfig::commit()
00082 {
00083     FUNCTIONSETUP;
00084 
00085 #ifdef DEBUG
00086     DEBUGKPILOT << fname
00087         << ": Message="
00088         << fConfigWidget->fLogMessage->text()
00089         << endl;
00090 #endif
00091 
00092     NullConduitSettings::setLogMessage( fConfigWidget->fLogMessage->text() );
00093     NullConduitSettings::self()->writeConfig();
00094     unmodified();
00095 }
00096 
00097 /* virtual */ void NullConduitConfig::load()
00098 {
00099     FUNCTIONSETUP;
00100     NullConduitSettings::self()->readConfig();
00101 
00102     fConfigWidget->fLogMessage->setText( NullConduitSettings::logMessage() );
00103 #ifdef DEBUG
00104     DEBUGKPILOT << fname
00105         << ": Read Message="
00106         << fConfigWidget->fLogMessage->text()
00107         << endl;
00108 #endif
00109 
00110     unmodified();
00111 }
00112 
00113 
00114 
00115 extern "C"
00116 {
00117 
00118 unsigned long version_conduit_null = Pilot::PLUGIN_API;
00119 void *init_conduit_null()
00120 {
00121     return new ConduitFactory<NullConduitConfig,NullConduit>(0,"nullconduit");
00122 }
00123 
00124 }
00125