diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-02-16 20:17:18 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-02-16 20:17:18 +0000 |
commit | cb7eddb91455a69cf66fcd717e91a51ca5e2cfef (patch) | |
tree | cf5546e4d7c44370fbe9ca2be937bd254f30ebaa /conduits/popmail/setupDialog.cc | |
download | kpilot-cb7eddb91455a69cf66fcd717e91a51ca5e2cfef.tar.gz kpilot-cb7eddb91455a69cf66fcd717e91a51ca5e2cfef.zip |
Moved kpilot from kdepim to applications, as the core Trinity libraries should not contain hardware-dependent software
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kpilot@1221127 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'conduits/popmail/setupDialog.cc')
-rw-r--r-- | conduits/popmail/setupDialog.cc | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/conduits/popmail/setupDialog.cc b/conduits/popmail/setupDialog.cc new file mode 100644 index 0000000..b8d3db7 --- /dev/null +++ b/conduits/popmail/setupDialog.cc @@ -0,0 +1,158 @@ +/* KPilot +** +** Copyright (C) 1998-2001 Dan Pilone +** +** This file is part of the popmail conduit, a conduit for KPilot that +** synchronises the Pilot's email application with the outside world, +** which currently means: +** -- sendmail or SMTP for outgoing mail +** -- POP or mbox for incoming mail +*/ + +/* +** This program is free software; you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation; either version 2 of the License, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program in a file called COPYING; if not, write to +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +** MA 02110-1301, USA. +*/ + +/* +** Bug reports and questions can be sent to kde-pim@kde.org +*/ + +#include "options.h" + + +#include <sys/types.h> +#include <sys/stat.h> +#include <stdlib.h> + +#include <kconfig.h> +#include <kstandarddirs.h> +#include <klineedit.h> +#include <kaboutdata.h> + +#include <tqcheckbox.h> +#include <tqdir.h> +#include <tqcombobox.h> + +#include "kfiledialog.h" + +#include <kurlrequester.h> + + +#include "popmail-factory.h" +#include "setup-dialog.h" +#include "setupDialog.moc" +#include "popmailSettings.h" + + + +PopMailWidgetConfig::PopMailWidgetConfig(TQWidget *p,const char *n) : + ConduitConfigBase(p,n), + fConfigWidget(new PopMailWidget(p,"PopMailWidget")) +{ + FUNCTIONSETUP; + fConduitName = i18n("KMail"); + KAboutData *fAbout = new KAboutData("popmailConduit", + I18N_NOOP("Mail Conduit for KPilot"), + KPILOT_VERSION, + I18N_NOOP("Configures the Mail Conduit for KPilot"), + KAboutData::License_GPL, + "(C) 2001, Dan Pilone, Michael Kropfberger, Adriaan de Groot"); + fAbout->addAuthor("Adriaan de Groot", + I18N_NOOP("Maintainer"), + "groot@kde.org", + "http://www.kpilot.org/"); + fAbout->addAuthor("Dan Pilone", + I18N_NOOP("Original Author")); + fAbout->addCredit("Michael Kropfberger", + I18N_NOOP("POP3 code")); + fAbout->addCredit("Marko Grönroos", + I18N_NOOP("SMTP support and redesign"), + "magi@iki.fi", + "http://www.iki.fi/magi/"); + + ConduitConfigBase::addAboutPage(fConfigWidget->fTabWidget,fAbout); + fWidget=fConfigWidget; + +#define CM(a,b) connect(fConfigWidget->a,b,this,TQT_SLOT(modified())); + CM(fSendMode,TQT_SIGNAL(activated(int))); + CM(fEmailFrom,TQT_SIGNAL(textChanged(const TQString &))); + CM(fSignature,TQT_SIGNAL(textChanged(const TQString &))); +#undef CM + + connect(fConfigWidget->fSendMode,TQT_SIGNAL(activated(int)), + this,TQT_SLOT(toggleSendMode(int))); + +} + +void PopMailWidgetConfig::commit() +{ + FUNCTIONSETUP; + + MailConduitSettings::self()->readConfig(); +#define WR(a,b,c) MailConduitSettings::set##a(fConfigWidget->b->c); + WR(SyncOutgoing,fSendMode,currentItem()); + WR(EmailAddress,fEmailFrom,text()); + WR(Signature,fSignature,url()); +#undef WR + + MailConduitSettings::self()->writeConfig(); + unmodified(); +} + +void PopMailWidgetConfig::load() +{ + FUNCTIONSETUP; + MailConduitSettings::self()->config()->sync(); + MailConduitSettings::self()->readConfig(); + +#define RD(a,b,c) fConfigWidget->a->b(MailConduitSettings::c()) + RD(fSendMode,setCurrentItem,syncOutgoing); + RD(fEmailFrom,setText,emailAddress); + RD(fSignature,setURL,signature); +#undef RD + + toggleSendMode(fConfigWidget->fSendMode->currentItem()); + + MailConduitSettings::self()->writeConfig(); + unmodified(); +} + + +/* slot */ void PopMailWidgetConfig::toggleSendMode(int i) +{ + FUNCTIONSETUP; +#ifdef DEBUG + DEBUGKPILOT << fname << ": Got mode " << i << endl; +#endif + +#define E(a,b) fConfigWidget->a->setEnabled(b) + switch(i) + { + case SendKMail : + E(fEmailFrom,true); + E(fSignature,true); + break; + case NoSend : /* FALLTHRU */ + default : + E(fEmailFrom,false); + E(fSignature,false); + break; + } +#undef E +} + + + |