summaryrefslogtreecommitdiffstats
path: root/kpilot/conduits/popmail
diff options
context:
space:
mode:
Diffstat (limited to 'kpilot/conduits/popmail')
-rw-r--r--kpilot/conduits/popmail/CMakeLists.txt43
-rw-r--r--kpilot/conduits/popmail/Makefile.am24
-rw-r--r--kpilot/conduits/popmail/popmail-conduit.cc416
-rw-r--r--kpilot/conduits/popmail/popmail-conduit.desktop109
-rw-r--r--kpilot/conduits/popmail/popmail-conduit.h74
-rw-r--r--kpilot/conduits/popmail/popmail-factory.cc47
-rw-r--r--kpilot/conduits/popmail/popmail-factory.h37
-rw-r--r--kpilot/conduits/popmail/popmail.kcfg25
-rw-r--r--kpilot/conduits/popmail/popmailSettings.kcfgc7
-rw-r--r--kpilot/conduits/popmail/setup-dialog.ui141
-rw-r--r--kpilot/conduits/popmail/setupDialog.cc158
-rw-r--r--kpilot/conduits/popmail/setupDialog.h62
12 files changed, 1143 insertions, 0 deletions
diff --git a/kpilot/conduits/popmail/CMakeLists.txt b/kpilot/conduits/popmail/CMakeLists.txt
new file mode 100644
index 00000000..daec3c3a
--- /dev/null
+++ b/kpilot/conduits/popmail/CMakeLists.txt
@@ -0,0 +1,43 @@
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+set(conduit_popmail_SRCS
+ popmail-factory.cc
+ popmail-conduit.cc
+ setupDialog.cc
+)
+
+set(conduit_popmail_UIS
+ setup-dialog.ui
+)
+
+set(conduit_popmail_KCFGS
+ popmailSettings.kcfgc
+)
+
+kde3_add_kcfg_files(conduit_popmail_SRCS ${conduit_popmail_KCFGS})
+kde3_add_ui_files(conduit_popmail_SRCS ${conduit_popmail_UIS})
+kde3_automoc(${conduit_popmail_SRCS})
+add_library(conduit_popmail SHARED ${conduit_popmail_SRCS})
+
+set_target_properties(
+ conduit_popmail PROPERTIES LOCATION ${KDE3_PLUGIN_INSTALL_DIR}
+ INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
+ PREFIX ""
+)
+
+kde3_install_libtool_file(conduit_popmail)
+
+install(
+ TARGETS conduit_popmail
+ LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR}
+)
+
+install(
+ FILES popmail-conduit.desktop DESTINATION ${KDE3_SERVICES_DIR}
+)
+
+install(
+ FILES popmail.kcfg DESTINATION ${KDE3_KCFG_DIR}
+)
diff --git a/kpilot/conduits/popmail/Makefile.am b/kpilot/conduits/popmail/Makefile.am
new file mode 100644
index 00000000..0e565805
--- /dev/null
+++ b/kpilot/conduits/popmail/Makefile.am
@@ -0,0 +1,24 @@
+### Makefile for the popmail conduit
+###
+
+INCLUDES= $(PISOCK_INCLUDE) -I$(top_srcdir)/kpilot/lib $(all_includes)
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = popmail-conduit.desktop
+kde_kcfg_DATA = popmail.kcfg
+
+####### This part is very kpilot specific
+# you can add here more. This one gets installed
+kde_module_LTLIBRARIES = conduit_popmail.la
+
+# Which sources should be compiled for popmail_conduit
+conduit_popmail_la_SOURCES = popmailSettings.kcfgc setup-dialog.ui \
+ popmail-factory.cc setupDialog.cc \
+ popmail-conduit.cc
+conduit_popmail_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
+conduit_popmail_la_LIBADD = ../../lib/libkpilot.la $(LIB_KIO)
+
+# this option you can leave out. Just, if you use "make dist", you need it
+noinst_HEADERS = popmail-conduit.h setupDialog.h
+
diff --git a/kpilot/conduits/popmail/popmail-conduit.cc b/kpilot/conduits/popmail/popmail-conduit.cc
new file mode 100644
index 00000000..47315eda
--- /dev/null
+++ b/kpilot/conduits/popmail/popmail-conduit.cc
@@ -0,0 +1,416 @@
+/* KPilot
+**
+** Copyright (C) 1998-2001 Dan Pilone
+** Copyright (C) 1999,2000 Michael Kropfberger
+**
+** 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 "popmail-conduit.h"
+
+extern "C"
+{
+
+unsigned long version_conduit_popmail = Pilot::PLUGIN_API;
+
+}
+
+#include <qsocket.h>
+#include <qregexp.h>
+
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/utsname.h>
+#include <ctype.h>
+
+#include <unistd.h>
+#include <errno.h>
+
+#include <time.h> // Needed by pilot-link include
+#include <pi-version.h>
+#if PILOT_LINK_MAJOR < 10
+#include <pi-config.h>
+#endif
+#include <pi-mail.h>
+
+#include <qdir.h>
+#include <qtextstream.h>
+#include <qtextcodec.h>
+
+#include <kapplication.h>
+#include <kmessagebox.h>
+#include <ksock.h>
+#include <kconfig.h>
+#include <ksimpleconfig.h>
+#include <dcopclient.h>
+#include <ktempfile.h>
+
+#include "pilotRecord.h"
+#include "pilotSerialDatabase.h"
+
+#include "popmailSettings.h"
+#include "setupDialog.h"
+
+static QString DATE_FORMAT("ddd, d MMM yyyy hh:mm:ss");
+
+PopMailConduit::PopMailConduit(KPilotLink *d,
+ const char *n,
+ const QStringList &l) :
+ ConduitAction(d,n,l)
+{
+ FUNCTIONSETUP;
+ fConduitName=i18n("KMail");
+}
+
+PopMailConduit::~PopMailConduit()
+{
+ FUNCTIONSETUP;
+}
+
+void PopMailConduit::doSync()
+{
+ FUNCTIONSETUP;
+
+ int sent_count=0;
+ int mode=MailConduitSettings::syncOutgoing();
+
+ DEBUGKPILOT << fname
+ << ": Outgoing mail disposition "
+ << mode << endl;
+
+ if(mode)
+ {
+ sent_count=sendPendingMail(mode);
+ }
+
+ if (sent_count>0)
+ {
+ if (sent_count>0)
+ {
+ addSyncLogEntry(i18n("Sent one message",
+ "Sent %n messages",sent_count));
+ }
+ }
+}
+
+
+// additional changes by Michael Kropfberger
+int PopMailConduit::sendPendingMail(int mode)
+{
+ FUNCTIONSETUP;
+ int count=0;
+
+ if (mode==PopMailWidgetConfig::SendKMail)
+ {
+ count=sendViaKMail();
+ }
+
+ if (count == 0)
+ {
+ WARNINGKPILOT << "Mail was not sent at all!" << endl;
+ emit logError(i18n("No mail was sent."));
+ }
+ else if (count < 0)
+ {
+ WARNINGKPILOT
+ << "Mail sending returned error " << count
+ << endl;
+ emit logError(i18n("No mail could be sent."));
+ }
+ else
+ {
+ DEBUGKPILOT << fname
+ << ": Sent "
+ << count
+ << " messages"
+ << endl;
+ }
+
+ return count;
+}
+
+
+QString PopMailConduit::getKMailOutbox() const
+{
+ FUNCTIONSETUP;
+
+ // Default to "outbox" with newer KMails.
+ KSimpleConfig c(CSL1("kmailrc"),true);
+ c.setGroup("General");
+
+ QString outbox = c.readEntry("outboxFolder");
+ if (outbox.isEmpty())
+ {
+ outbox = MailConduitSettings::outboxFolder();
+ }
+
+ if (outbox.isEmpty()) outbox=CSL1("outbox");
+
+ return outbox;
+}
+
+/*
+ * This function uses KMail's DCOP interface to put all the
+ * outgoing mail into the outbox.
+ */
+int PopMailConduit::sendViaKMail()
+{
+ FUNCTIONSETUP;
+ int count=0;
+ QString kmailOutboxName = getKMailOutbox();
+
+ DCOPClient *dcopptr = KApplication::kApplication()->dcopClient();
+ if (!dcopptr)
+ {
+ WARNINGKPILOT << "Cannot get DCOP client."
+ << endl;
+ KMessageBox::error(0L,
+ i18n("Could not connect to DCOP server for "
+ "the KMail connection."),
+ i18n("Error Sending Mail"));
+ return -1;
+ }
+
+ if (!dcopptr->isAttached())
+ {
+ dcopptr->attach();
+ }
+
+ while (PilotRecord *pilotRec = fDatabase->readNextRecInCategory(1))
+ {
+ DEBUGKPILOT << fname
+ << ": Reading "
+ << count + 1
+ << "th message"
+ << endl;
+
+ if (pilotRec->isDeleted() || pilotRec->isArchived())
+ {
+ DEBUGKPILOT << fname
+ << ": Skipping record."
+ << endl;
+ continue;
+ }
+
+ struct Mail theMail;
+ KTempFile t;
+ t.setAutoDelete(true);
+
+ if (t.status())
+ {
+ WARNINGKPILOT << "Cannot open temp file." << endl;
+ KMessageBox::error(0L,
+ i18n("Cannot open temporary file to store "
+ "mail from Pilot in."),
+ i18n("Error Sending Mail"));
+ continue;
+ }
+
+ FILE *sendf = t.fstream();
+
+ if (!sendf)
+ {
+ WARNINGKPILOT
+ << "Cannot open temporary file for writing!" << endl;
+ KMessageBox::error(0L,
+ i18n("Cannot open temporary file to store "
+ "mail from Pilot in."),
+ i18n("Error Sending Mail"));
+ continue;
+ }
+
+ unpack_Mail(&theMail,
+ (unsigned char*)pilotRec->data(),
+ pilotRec->size());
+ writeMessageToFile(sendf, theMail);
+
+
+ QByteArray data,returnValue;
+ QCString returnType;
+ QDataStream arg(data,IO_WriteOnly);
+
+ arg << kmailOutboxName << t.name() << CSL1("N") ;
+
+ if (!dcopptr->call("kmail",
+ "KMailIface",
+ "dcopAddMessage(QString,QString,QString)",
+ data,
+ returnType,
+ returnValue,
+ true))
+ {
+ WARNINGKPILOT << "DCOP call failed." << endl;
+
+ KMessageBox::error(0L,
+ i18n("DCOP connection with KMail failed."),
+ i18n("Error Sending Mail"));
+ continue;
+ }
+
+ DEBUGKPILOT << fname
+ << ": DCOP call returned "
+ << returnType
+ << " of "
+ << (const char *)returnValue
+ << endl;
+
+ // Mark it as filed...
+ pilotRec->setCategory(3);
+ pilotRec->setModified( false );
+ fDatabase->writeRecord(pilotRec);
+ delete pilotRec;
+ // This is ok since we got the mail with unpack mail..
+ free_Mail(&theMail);
+
+ count++;
+ }
+
+ return count;
+}
+
+// From pilot-link-0.8.7 by Kenneth Albanowski
+// additional changes by Michael Kropfberger
+
+void PopMailConduit::writeMessageToFile(FILE* sendf, struct Mail& theMail)
+{
+ FUNCTIONSETUP;
+
+ QTextStream mailPipe(sendf, IO_WriteOnly);
+
+ QString fromAddress = MailConduitSettings::emailAddress();
+ mailPipe << "From: " << fromAddress << "\r\n";
+ mailPipe << "To: " << theMail.to << "\r\n";
+ if(theMail.cc)
+ mailPipe << "Cc: " << theMail.cc << "\r\n";
+ if(theMail.bcc)
+ mailPipe << "Bcc: " << theMail.bcc << "\r\n";
+ if(theMail.replyTo)
+ mailPipe << "Reply-To: " << theMail.replyTo << "\r\n";
+ if(theMail.subject)
+ mailPipe << "Subject: " << theMail.subject << "\r\n";
+
+ // if our struct indicates that it's dated, then use the date it
+ // holds. otherwise, provide current date. either way, we need to
+ // have a date...
+ QDateTime date = QDateTime::currentDateTime();
+ if (theMail.dated)
+ {
+ date = readTm(theMail.date);
+ }
+
+ QString dateString = date.toString(DATE_FORMAT);
+
+ mailPipe << "Date: " << dateString << "\r\n";
+
+ mailPipe << "X-mailer: " << "Popmail-Conduit " << KPILOT_VERSION << "\r\n";
+ mailPipe << "\r\n";
+
+
+ DEBUGKPILOT << fname << ": To: " << theMail.to << endl;
+
+
+ if(theMail.body)
+ {
+ DEBUGKPILOT << fname << ": Sent body." << endl;
+ mailPipe << theMail.body << "\r\n";
+ }
+
+ //insert the real signature file from disk
+ QString signature = MailConduitSettings::signature();
+ if(!signature.isEmpty())
+ {
+ DEBUGKPILOT << fname << ": Reading signature" << endl;
+
+ QFile f(signature);
+ if ( f.open(IO_ReadOnly) )
+ { // file opened successfully
+ mailPipe << "-- \r\n";
+ QTextStream t( &f ); // use a text stream
+ while ( !t.eof() )
+ { // until end of file...
+ mailPipe << t.readLine() << "\r\n";
+ }
+ f.close();
+ }
+ }
+ mailPipe << "\r\n";
+
+ DEBUGKPILOT << fname << ": Done" << endl;
+}
+
+
+/* virtual */ void PopMailConduit::doTest()
+{
+ FUNCTIONSETUP;
+
+ QString outbox = getKMailOutbox();
+
+ DEBUGKPILOT << fname
+ << ": KMail's outbox is "
+ << outbox
+ << endl;
+
+ QDateTime date = QDateTime::currentDateTime();
+ QString dateString = date.toString(DATE_FORMAT);
+
+ DEBUGKPILOT << fname << ": Date format example: [" << dateString
+ << "]" << endl;
+}
+
+/* virtual */ bool PopMailConduit::exec()
+{
+ FUNCTIONSETUP;
+
+ if (syncMode().isTest())
+ {
+ doTest();
+ }
+ else if (syncMode() == SyncMode::eBackup)
+ {
+ emit logError(i18n("Cannot perform backup of mail database"));
+ }
+ else
+ {
+ fDatabase = deviceLink()->database( CSL1("MailDB") );
+
+ if (!fDatabase || !fDatabase->isOpen())
+ {
+ emit logError(i18n("Unable to open mail database on handheld"));
+ KPILOT_DELETE(fDatabase);
+ return false;
+ }
+
+ doSync();
+ fDatabase->resetSyncFlags();
+ KPILOT_DELETE(fDatabase);
+ }
+ delayDone();
+ return true;
+}
diff --git a/kpilot/conduits/popmail/popmail-conduit.desktop b/kpilot/conduits/popmail/popmail-conduit.desktop
new file mode 100644
index 00000000..b4cdc017
--- /dev/null
+++ b/kpilot/conduits/popmail/popmail-conduit.desktop
@@ -0,0 +1,109 @@
+[Desktop Entry]
+Type=Service
+Comment=Send mail from your handheld through KMail.
+Comment[af]=Stuur pos vanaf jou draagbare toestel deur KMail.
+Comment[bg]=Изпращане на поща от мобилно устройство чрез KMail.
+Comment[ca]=Envia correu des de la vostra agenda electrònica a través de KMail.
+Comment[cs]=Odeslání zprávy z PDA přes KMail.
+Comment[da]=Send post fra din håndholdte gennem KMail.
+Comment[de]=Zum Versenden von E-Mails mit dem Taschencomputer via KMail.
+Comment[el]=Αποστολή αλληλογραφίας από τον υπολογιστή παλάμης σας μέσω του KMail.
+Comment[eo]=Sendu poŝton de via poŝkomputilo per KMail.
+Comment[es]=Envía el correo de la agenda electrónica a través de KMail.
+Comment[et]=Saadab pihuseadmest KMaili vahendusel e-kirja.
+Comment[eu]=Bidali posta zure agenda elektronikotik KMail-en bidez.
+Comment[fa]=ارسال نامه از طریق KMail، از دستی شما.
+Comment[fi]=Lähetä sähköpostia taskutietokoneelta KMailin kautta.
+Comment[fr]=Permet d'envoyer des messages du Palm vers KMail
+Comment[fy]=Dit conduit ferstjoerd e-post fan jo handheld mei help fan KMail.
+Comment[gl]=Enviar correo dende o seu aparello de man a través de KMail.
+Comment[hu]=Ezzel a csatolóval kézi számítógépről lehet levelet küldeni a KMailen keresztül.
+Comment[is]=Sendu tölvupóst frá lófatölvunni þinni gegnum KMail.
+Comment[it]=Invia la posta dal tuo palmare tramite KMail.
+Comment[ja]=KMail 経由でハンドヘルドからメールを送信します。
+Comment[ka]= ფოსტის გაგზავნა პორტატიული მოწყობილობიდან KMail-ის საშუალებით.
+Comment[kk]=Қалта құрылғының поштасын KMail арқылы жіберу.
+Comment[km]=ផ្ញើ​សំបុត្រ​ទៅ​ឧបករណ៍​យួរដៃ​របស់​អ្នក​តាម​រយៈ KMail ។
+Comment[lt]=Siųsti paštą iš nešiojamo įrenginio per KMail.
+Comment[ms]=Menghantar mel dari komputer telapak melalui KMail.
+Comment[nb]=Send e-post fra PDA-en gjennom KMail.
+Comment[nds]=Nettbreven vun Dien Handreekner över KMail afsennen
+Comment[ne]=तपाईँको ह्यान्डहेल्डबाट केडीई मेलहुदै पत्र पठाउनुहोस् ।
+Comment[nl]=Dit conduit verzendt mail van uw handheld met behulp van KMail.
+Comment[pl]=Wysyła pocztę z palmtopa za pomocą KMail.
+Comment[pt]=Enviar e-mail do seu dispositivo móvel através do KMail.
+Comment[pt_BR]=Envia e-mail do seu handheld através do Kmail.
+Comment[ru]=Отправка почты с КПК через KMail.
+Comment[sk]=Pošle poštu z prenosného zariadenia cez KMail.
+Comment[sl]=Pošljite pošto z vašega ročnega računalnika preko KMaila.
+Comment[sr]=Пошаљите пошту са вашег ручног рачунара кроз KMail.
+Comment[sr@Latn]=Pošaljite poštu sa vašeg ručnog računara kroz KMail.
+Comment[sv]=Skicka e-post från handdatorn via Kmail.
+Comment[ta]=இந்த காப்புக்குழாய் உங்கள் கையேட்டில் இருந்து தேதி புத்தகத்தை கேஅமைபாளருக்கு ஒத்திசைக்கிறது
+Comment[tr]=El bilgisayarınızdan KMail aracılığı ile e-posta gönderir.
+Comment[uk]=Відсилання пошти з кишенькового пристрою через KMail.
+Comment[zh_CN]=通过 KMail 从您的手持设备发送邮件。
+Comment[zh_TW]=透過 KMail 送出您 handheld 的信件。
+Name=Mail
+Name[af]=Pos
+Name[ar]=البريد
+Name[be]=Пошта
+Name[bg]=Поща
+Name[br]=Lizher
+Name[ca]=Correu
+Name[cs]=Pošta
+Name[cy]=Ebost
+Name[da]=Brev
+Name[de]=E-Mail
+Name[eo]=Retpoŝto
+Name[es]=Correo
+Name[et]=E-post
+Name[eu]=Posta
+Name[fa]=نامه
+Name[fi]=Sähköposti
+Name[fr]=Messages
+Name[fy]=E-post
+Name[ga]=Ríomhphost
+Name[gl]=Correo-e
+Name[he]=דוא"ל
+Name[hi]=डाक
+Name[hr]=Pošta
+Name[hu]=E-mail
+Name[is]=Póstur
+Name[it]=Posta
+Name[ja]=メール
+Name[ka]=ფოსტა
+Name[kk]=Пошта
+Name[km]=សំបុត្រ
+Name[lt]=Paštas
+Name[mk]=Е-пошта
+Name[ms]=Mel
+Name[nb]=E-post
+Name[nds]=Nettpost
+Name[ne]=पत्र
+Name[nl]=E-mail
+Name[nn]=E-post
+Name[pa]=ਪੱਤਰ
+Name[pl]=Poczta
+Name[pt]=E-mail
+Name[pt_BR]=Correio
+Name[ro]=E-Mail
+Name[ru]=Почта
+Name[se]=E-boasta
+Name[sk]=Pošta
+Name[sl]=Pošta
+Name[sr]=Пошта
+Name[sr@Latn]=Pošta
+Name[sv]=Brev
+Name[ta]=அஞ்சல்
+Name[tg]=Мактуб
+Name[th]=จดหมาย
+Name[tr]=Posta
+Name[uk]=Пошта
+Name[uz]=Xat-xabar
+Name[uz@cyrillic]=Хат-хабар
+Name[zh_CN]=邮件
+Name[zh_TW]=郵件
+Implemented=file
+ServiceTypes=KPilotConduit
+X-KDE-Library=conduit_popmail
diff --git a/kpilot/conduits/popmail/popmail-conduit.h b/kpilot/conduits/popmail/popmail-conduit.h
new file mode 100644
index 00000000..1df1a691
--- /dev/null
+++ b/kpilot/conduits/popmail/popmail-conduit.h
@@ -0,0 +1,74 @@
+#ifndef _KPILOT_POPMAIL_CONDUIT_H
+#define _KPILOT_POPMAIL_CONDUIT_H
+/* popmail-conduit.h KPilot
+**
+** Copyright (C) 1998,1999,2000 Dan Pilone
+** Copyright (C) 1999,2000 Michael Kropfberger
+**
+** 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 "plugin.h"
+
+class KSocket;
+
+class PilotRecord;
+class PilotDatabase;
+
+class PopMailConduit : public ConduitAction
+{
+public:
+ PopMailConduit(KPilotLink *d,
+ const char *n=0L,
+ const QStringList &l=QStringList());
+ virtual ~PopMailConduit();
+
+protected:
+ virtual bool exec();
+
+ // static PilotRecord *readMessage(FILE *mailbox,
+ // char *buffer,int bufferSize);
+
+protected:
+ void doSync();
+ void doTest();
+
+ // Pilot -> Sendmail
+ //
+ //
+ int sendPendingMail(int mode /* unused */);
+ // int sendViaSendmail();
+ int sendViaKMail();
+ // int sendViaSMTP();
+ void writeMessageToFile(FILE* sendf, struct Mail& theMail);
+ QString getKMailOutbox() const;
+
+};
+
+#endif
diff --git a/kpilot/conduits/popmail/popmail-factory.cc b/kpilot/conduits/popmail/popmail-factory.cc
new file mode 100644
index 00000000..dc2a0cd1
--- /dev/null
+++ b/kpilot/conduits/popmail/popmail-factory.cc
@@ -0,0 +1,47 @@
+/* KPilot
+**
+** Copyright (C) 2001 by Dan Pilone
+** Copyright (C) 2006 by Adriaan de Groot <groot@kde.org>
+**
+** This file defines the factory for the popmail-conduit plugin.
+*/
+
+/*
+** 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 "setupDialog.h"
+#include "popmail-conduit.h"
+#include "pluginfactory.h"
+
+
+extern "C"
+{
+
+void *init_conduit_popmail()
+{
+ return new ConduitFactory<PopMailWidgetConfig,PopMailConduit>;
+}
+
+}
+
diff --git a/kpilot/conduits/popmail/popmail-factory.h b/kpilot/conduits/popmail/popmail-factory.h
new file mode 100644
index 00000000..2cab4d84
--- /dev/null
+++ b/kpilot/conduits/popmail/popmail-factory.h
@@ -0,0 +1,37 @@
+#ifndef _KPILOT_POPMAIL_FACTORY_H
+#define _KPILOT_POPMAIL_FACTORY_H
+/* popmail-factory.h KPilot
+**
+** Copyright (C) 2001 by Dan Pilone
+**
+** This file defines the factory for the popmail-conduit plugin.
+*/
+
+/*
+** 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
+*/
+
+
+extern "C"
+{
+void *init_conduit_popmail();
+}
+
+#endif
diff --git a/kpilot/conduits/popmail/popmail.kcfg b/kpilot/conduits/popmail/popmail.kcfg
new file mode 100644
index 00000000..65056cb5
--- /dev/null
+++ b/kpilot/conduits/popmail/popmail.kcfg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+<kcfgfile name="kpilot_mailconduitrc"/>
+<group name="General">
+ <entry name="SyncOutgoing" type="UInt">
+ <label>Selects the way in which mail is sent: none (0), kmail (1).</label>
+ <default>0</default>
+ </entry>
+ <entry name="EmailAddress" type="String">
+ <label>The email address entered in the To: field of outgoing messages.</label>
+ <default></default>
+ </entry>
+ <entry name="Signature" type="Path">
+ <label>The pathname of your .signature file.</label>
+ <default>$HOME/.signature</default>
+ </entry>
+ <entry name="OutboxFolder" type="String">
+ <label>The name of KMail's outbox - use with caution.</label>
+ <default></default>
+ </entry>
+</group>
+</kcfg>
diff --git a/kpilot/conduits/popmail/popmailSettings.kcfgc b/kpilot/conduits/popmail/popmailSettings.kcfgc
new file mode 100644
index 00000000..1ac6276f
--- /dev/null
+++ b/kpilot/conduits/popmail/popmailSettings.kcfgc
@@ -0,0 +1,7 @@
+File=popmail.kcfg
+ClassName=MailConduitSettings
+Singleton=true
+ItemAccessors=true
+Mutators=true
+GlobalEnums=true
+SetUserTexts=true
diff --git a/kpilot/conduits/popmail/setup-dialog.ui b/kpilot/conduits/popmail/setup-dialog.ui
new file mode 100644
index 00000000..e10f0e4b
--- /dev/null
+++ b/kpilot/conduits/popmail/setup-dialog.ui
@@ -0,0 +1,141 @@
+<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
+<class>PopMailWidget</class>
+<widget class="QWidget">
+ <property name="name">
+ <cstring>PopMailWidget</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>363</width>
+ <height>281</height>
+ </rect>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <widget class="QTabWidget" row="0" column="0">
+ <property name="name">
+ <cstring>fTabWidget</cstring>
+ </property>
+ <widget class="QWidget">
+ <property name="name">
+ <cstring>tab</cstring>
+ </property>
+ <attribute name="title">
+ <string>Send Mail</string>
+ </attribute>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <spacer row="5" column="1">
+ <property name="name">
+ <cstring>spacer1</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
+ <property name="text">
+ <string>Send method:</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;qt&gt;Select the method KPilot will use to send the mail from your Handheld to the recipients here. Depending on the method you choose, the other fields in the dialog may be enabled or disabled. Currently, the only &lt;i&gt;working&lt;/i&gt; method is through KMail.&lt;/qt&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Email address:</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;qt&gt;Enter the email address you want to send messages as here.&lt;/qt&gt;</string>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="1" column="1">
+ <property name="name">
+ <cstring>fEmailFrom</cstring>
+ </property>
+ <property name="text">
+ <string>$USER</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;qt&gt;Enter the email address you want to send messages as here.&lt;/qt&gt;</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2</cstring>
+ </property>
+ <property name="text">
+ <string>Signature file:</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;qt&gt;If you want to add a signature file, enter the location of your signature file (usually, &lt;i&gt;.signature&lt;/i&gt;, located in your home folder) here, or select it clicking the file picker button. The signature file contains the text that is added to the end of your outgoing mail messages.&lt;/qt&gt;</string>
+ </property>
+ </widget>
+ <widget class="KURLRequester" row="2" column="1">
+ <property name="name">
+ <cstring>fSignature</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;qt&gt;If you want to add a signature file, enter the location of your signature file (usually, &lt;i&gt;.signature&lt;/i&gt;, located in your home folder) here, or select it clicking the file picker button. The signature file contains the text that is added to the end of your outgoing mail messages.&lt;/qt&gt;</string>
+ </property>
+ </widget>
+ <widget class="QComboBox" row="0" column="1">
+ <item>
+ <property name="text">
+ <string>Do Not Send Mail</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Use KMail</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>fSendMode</cstring>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>&lt;qt&gt;Select the method KPilot will use to send the mail from your Handheld to the recipients here. Depending on the method you choose, the other fields in the dialog may be enabled or disabled. Currently, the only &lt;i&gt;working&lt;/i&gt; method is through KMail.&lt;/qt&gt;</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </widget>
+ </grid>
+</widget>
+<layoutdefaults spacing="6" margin="11"/>
+<includes>
+ <include location="global" impldecl="in implementation">klineedit.h</include>
+ <include location="global" impldecl="in implementation">kurlrequester.h</include>
+ <include location="global" impldecl="in implementation">kpushbutton.h</include>
+</includes>
+</UI>
diff --git a/kpilot/conduits/popmail/setupDialog.cc b/kpilot/conduits/popmail/setupDialog.cc
new file mode 100644
index 00000000..64553562
--- /dev/null
+++ b/kpilot/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 <qcheckbox.h>
+#include <qdir.h>
+#include <qcombobox.h>
+
+#include "kfiledialog.h"
+
+#include <kurlrequester.h>
+
+
+#include "popmail-factory.h"
+#include "setup-dialog.h"
+#include "setupDialog.moc"
+#include "popmailSettings.h"
+
+
+
+PopMailWidgetConfig::PopMailWidgetConfig(QWidget *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&ouml;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,SLOT(modified()));
+ CM(fSendMode,SIGNAL(activated(int)));
+ CM(fEmailFrom,SIGNAL(textChanged(const QString &)));
+ CM(fSignature,SIGNAL(textChanged(const QString &)));
+#undef CM
+
+ connect(fConfigWidget->fSendMode,SIGNAL(activated(int)),
+ this,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
+}
+
+
+
diff --git a/kpilot/conduits/popmail/setupDialog.h b/kpilot/conduits/popmail/setupDialog.h
new file mode 100644
index 00000000..248b4ecb
--- /dev/null
+++ b/kpilot/conduits/popmail/setupDialog.h
@@ -0,0 +1,62 @@
+#ifndef _POPMAIL_SETUPDIALOG_H
+#define _POPMAIL_SETUPDIALOG_H
+/* setupDialog.h 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 "plugin.h"
+
+class PopMailWidget; // From setup-dialog.ui
+
+class PopMailWidgetConfig : public ConduitConfigBase
+{
+Q_OBJECT
+public:
+ PopMailWidgetConfig(QWidget *, const char *);
+ virtual void load();
+ virtual void commit();
+
+ static ConduitConfigBase *create(QWidget *w, const char *n)
+ { return new PopMailWidgetConfig(w,n); } ;
+
+ // These enums must follow the order of items in the combo box
+ enum SendMode { NoSend=0, SendKMail=1 } ;
+
+protected:
+ PopMailWidget *fConfigWidget;
+
+public slots:
+ void toggleSendMode(int);
+} ;
+
+
+#endif