-rw-r--r-- | kmicromail/libmailwrapper/generatemail.h | 5 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/libmailwrapper.pro | 64 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mailwrapper.h | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.cpp | 20 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/mhwrapper.h | 6 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.h | 1 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.cpp | 15 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/smtpwrapper.h | 2 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/storemail.h | 2 |
9 files changed, 89 insertions, 28 deletions
diff --git a/kmicromail/libmailwrapper/generatemail.h b/kmicromail/libmailwrapper/generatemail.h index a767b61..b9f8285 100644 --- a/kmicromail/libmailwrapper/generatemail.h +++ b/kmicromail/libmailwrapper/generatemail.h @@ -1,29 +1,30 @@ #ifndef __GENERATE_MAIL_H #define __GENERATE_MAIL_H -#include <qpe/applnk.h> +//#include <qpe/applnk.h> #include <qobject.h> #include <libetpan/clist.h> +#include "mailwrapper.h" #include <opie2/osmartpointer.h> class Mail; class RecMail; -class Attachment; + struct mailimf_fields; struct mailimf_field; struct mailimf_mailbox; struct mailmime; struct mailimf_address_list; class progressMailSend; struct mailsmtp; class Generatemail : public QObject { Q_OBJECT public: Generatemail(); virtual ~Generatemail(); protected: diff --git a/kmicromail/libmailwrapper/libmailwrapper.pro b/kmicromail/libmailwrapper/libmailwrapper.pro new file mode 100644 index 0000000..2b005d8 --- a/dev/null +++ b/kmicromail/libmailwrapper/libmailwrapper.pro @@ -0,0 +1,64 @@ +TEMPLATE = lib +CONFIG += qt warn_on + +HEADERS = mailwrapper.h \ + imapwrapper.h \ + mailtypes.h \ + pop3wrapper.h \ + abstractmail.h \ + smtpwrapper.h \ + genericwrapper.h \ + mboxwrapper.h \ + settings.h \ + logindialog.h \ + sendmailprogress.h \ + statusmail.h \ + mhwrapper.h \ + nntpwrapper.h \ + generatemail.h \ + storemail.h \ + ../qpe/global.h + +SOURCES = imapwrapper.cpp \ + mailwrapper.cpp \ + mailtypes.cpp \ + pop3wrapper.cpp \ + abstractmail.cpp \ + smtpwrapper.cpp \ + genericwrapper.cpp \ + mboxwrapper.cpp \ + settings.cpp \ + logindialog.cpp \ + sendmailprogress.cpp \ + statusmail.cpp \ + mhwrapper.cpp \ + nntpwrapper.cpp \ + generatemail.cpp \ + storemail.cpp \ + ../qpe/global.cpp + +INTERFACES = logindialogui.ui \ + sendmailprogressui.ui + +INCLUDEPATH += .. ../../microkde ../../microkde/kdecore ../libetpan/include +LIBS += -lssl -lcrypto + +#-lqpe -letpan + +DESTDIR = ../../bin +TARGET = micromailwrapper + +DEFINES += DESKTOP_VERSION +unix : { +OBJECTS_DIR = obj/unix +MOC_DIR = moc/unix +} +win32: { +DEFINES += _WIN32_ +LIBS += mfc71u.lib +QMAKE_LINK += /NODEFAULTLIB:LIBC +#QMAKE_LINK += /NODEFAULTLIB:MSVCRT +#QMAKE_LINK += /NODEFAULTLIB:uafxcw.lib +OBJECTS_DIR = obj/win +MOC_DIR = moc/win +} diff --git a/kmicromail/libmailwrapper/mailwrapper.h b/kmicromail/libmailwrapper/mailwrapper.h index 2ba908b..88f10da 100644 --- a/kmicromail/libmailwrapper/mailwrapper.h +++ b/kmicromail/libmailwrapper/mailwrapper.h @@ -1,20 +1,20 @@ #ifndef MAILWRAPPER_H #define MAILWRAPPER_H -#include <qpe/applnk.h> +//#include <qpe/applnk.h> #include <qbitarray.h> #include <qdatetime.h> #include <qfileinfo.h> #include <kiconloader.h> #include "settings.h" #include <opie2/osmartpointer.h> /* class Attachment { public: Attachment( DocLnk lnk ); virtual ~Attachment(){} const QString getFileName()const{ return doc.file(); } diff --git a/kmicromail/libmailwrapper/mhwrapper.cpp b/kmicromail/libmailwrapper/mhwrapper.cpp index f4133c0..de6d220 100644 --- a/kmicromail/libmailwrapper/mhwrapper.cpp +++ b/kmicromail/libmailwrapper/mhwrapper.cpp @@ -1,27 +1,27 @@ // CHANGED 2004-09-31 Lutz Rogowski #include "mhwrapper.h" #include "mailtypes.h" #include "mailwrapper.h" #include <libetpan/libetpan.h> #include <qdir.h> #include <qmessagebox.h> #include <stdlib.h> #include <qpe/global.h> -#include <oprocess.h> #include <klocale.h> +#include <kglobal.h> //#include <opie2/odebug.h> using namespace Opie::Core; MHwrapper::MHwrapper(const QString & mbox_dir,const QString&mbox_name) : Genericwrapper(),MHPath(mbox_dir),MHName(mbox_name) { if (MHPath.length()>0) { if (MHPath[MHPath.length()-1]=='/') { MHPath=MHPath.left(MHPath.length()-1); } //odebug << MHPath << oendl; QDir dir(MHPath); if (!dir.exists()) { dir.mkdir(MHPath); } init_storage(); @@ -302,65 +302,59 @@ int MHwrapper::deleteAllMail(const FolderP&tfolder) int MHwrapper::deleteMbox(const FolderP&tfolder) { init_storage(); if (!m_storage) { return 0; } if (!tfolder) return 0; if (tfolder->getName()=="/" || tfolder->getName().isEmpty()) return 0; int r = mailsession_delete_folder(m_storage->sto_session,(char*)tfolder->getName().latin1()); if (r != MAIL_NO_ERROR) { qDebug("error deleting mail box "); return 0; } + QString delDir = locateLocal( "apps", "kopiemail")+ "localmail"; + qDebug("*****************\ndel %s %s ", delDir.latin1(),tfolder->getName().latin1() ); +#if 0 QString cmd = "rm -rf "+tfolder->getName(); QStringList command; command << "/bin/sh"; command << "-c"; command << cmd.latin1(); OProcess *process = new OProcess(); + /* connect(process, SIGNAL(processExited(Opie::Core::OProcess*)), this, SLOT( processEnded(Opie::Core::OProcess*))); connect(process, SIGNAL( receivedStderr(Opie::Core::OProcess*,char*,int)), this, SLOT( oprocessStderr(Opie::Core::OProcess*,char*,int))); - + */ *process << command; removeMboxfailed = false; if(!process->start(OProcess::Block, OProcess::All) ) { qDebug("could not start process "); return 0; } +#endif qDebug("mail box deleted "); return 1; } -void MHwrapper::processEnded(OProcess *p) -{ - if (p) delete p; -} - -void MHwrapper::oprocessStderr(OProcess*, char *buffer, int ) -{ - QString lineStr = buffer; - QMessageBox::warning( 0, i18n("Error"), lineStr ,i18n("Ok") ); - removeMboxfailed = true; -} void MHwrapper::statusFolder(folderStat&target_stat,const QString & mailbox) { init_storage(); if (!m_storage) { return; } target_stat.message_count = 0; target_stat.message_unseen = 0; target_stat.message_recent = 0; QString f = buildPath(mailbox); int r = mailsession_status_folder(m_storage->sto_session,(char*)f.latin1(),&target_stat.message_count, &target_stat.message_recent,&target_stat.message_unseen); if (r != MAIL_NO_ERROR) { Global::statusMessage(i18n("Error retrieving status")); } diff --git a/kmicromail/libmailwrapper/mhwrapper.h b/kmicromail/libmailwrapper/mhwrapper.h index d1b7d1f..87f8ca1 100644 --- a/kmicromail/libmailwrapper/mhwrapper.h +++ b/kmicromail/libmailwrapper/mhwrapper.h @@ -1,29 +1,27 @@ // CHANGED 2004-09-31 Lutz Rogowski #ifndef __MH_WRAPPER_H #define __MH_WRAPPER_H #include "maildefines.h" #include "genericwrapper.h" #include <qstring.h> class encodedString; struct mailmbox_folder; -namespace Opie {namespace Core {class OProcess;}} - class MHwrapper : public Genericwrapper { Q_OBJECT public: MHwrapper(const QString & dir,const QString&name); virtual ~MHwrapper(); virtual void listMessages(const QString & mailbox, QValueList<Opie::Core::OSmartPointer<RecMail> > &target, int maxSizeInKb = 0 ); virtual QValueList<Opie::Core::OSmartPointer<Folder> >* listFolders(); virtual void statusFolder(folderStat&target_stat,const QString & mailbox="INBOX"); virtual void deleteMail(const RecMailP&mail); virtual void answeredMail(const RecMailP&mail); virtual void mvcpMail(const RecMailP&mail,const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); virtual void mvcpAllMails(const Opie::Core::OSmartPointer<Folder>&fromFolder, const QString&targetFolder,AbstractMail*targetWrapper,bool moveit); @@ -32,31 +30,29 @@ public: const QString&d="",bool s=false); virtual int deleteMbox(const Opie::Core::OSmartPointer<Folder>&); virtual void storeMessage(const char*msg,size_t length, const QString&folder); virtual RecBodyP fetchBody( const RecMailP &mail ); static void mbox_progress( size_t current, size_t maximum ); virtual encodedString* fetchRawBody(const RecMailP&mail); virtual void deleteMails(const QString & FolderName,const QValueList<Opie::Core::OSmartPointer<RecMail> > &target); virtual int deleteAllMail(const Opie::Core::OSmartPointer<Folder>&); virtual MAILLIB::ATYPE getType()const; virtual const QString&getName()const; virtual Account* getAccount() { return 0; }; public slots: - /* for deleting maildirs we are using a system call */ - virtual void oprocessStderr(Opie::Core::OProcess*, char *buffer, int ); - virtual void processEnded(Opie::Core::OProcess *); + protected: QString buildPath(const QString&p); QString MHPath; QString MHName; void init_storage(); void clean_storage(); bool removeMboxfailed; }; #endif diff --git a/kmicromail/libmailwrapper/settings.h b/kmicromail/libmailwrapper/settings.h index 61051dd..79567ef 100644 --- a/kmicromail/libmailwrapper/settings.h +++ b/kmicromail/libmailwrapper/settings.h @@ -1,26 +1,27 @@ #ifndef SETTINGS_H #define SETTINGS_H #include "maildefines.h" /* OPIE */ /* QT */ #include <qobject.h> #include <qlist.h> +#include <qstringlist.h> #include <qdatetime.h> class Account { public: Account(); virtual ~Account() {} void remove(); void setAccountName( QString name ) { accountName = name; } const QString&getAccountName()const{ return accountName; } MAILLIB::ATYPE getType()const{ return type; } void setServer(const QString&str){ server = str; } const QString&getServer()const{ return server; } diff --git a/kmicromail/libmailwrapper/smtpwrapper.cpp b/kmicromail/libmailwrapper/smtpwrapper.cpp index dee1477..eb07ef1 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.cpp +++ b/kmicromail/libmailwrapper/smtpwrapper.cpp @@ -1,58 +1,63 @@ #include "smtpwrapper.h" #include "mailwrapper.h" #include "abstractmail.h" #include "logindialog.h" #include "mailtypes.h" #include "sendmailprogress.h" //#include <opie2/odebug.h> //#include <qt.h> #include <qapplication.h> #include <qmessagebox.h> #include <stdlib.h> -#include <qpe/config.h> +#ifndef DESKTOP_VERSION +//#include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> - +#endif #include <libetpan/libetpan.h> #include <klocale.h> +#include <kglobal.h> +#include <kconfig.h> using namespace Opie::Core; progressMailSend*SMTPwrapper::sendProgress = 0; SMTPwrapper::SMTPwrapper(SMTPaccount * aSmtp ) : Generatemail() { m_SmtpAccount = aSmtp; - Config cfg( "mail" ); + KConfig cfg( locateLocal("config", "kopiemail" ) ); cfg.setGroup( "Status" ); m_queuedMail = cfg.readNumEntry( "outgoing", 0 ); emit queuedMails( m_queuedMail ); connect( this, SIGNAL( queuedMails(int) ), this, SLOT( emitQCop(int) ) ); m_smtp = 0; } SMTPwrapper::~SMTPwrapper() { disc_server(); } void SMTPwrapper::emitQCop( int queued ) { +#ifndef DESKTOP_VERSION QCopEnvelope env( "QPE/Pim", "outgoingMails(int)" ); env << queued; +#endif } QString SMTPwrapper::mailsmtpError( int errnum ) { switch ( errnum ) { case MAILSMTP_NO_ERROR: return i18n( "No error" ); case MAILSMTP_ERROR_UNEXPECTED_CODE: return i18n( "Unexpected error code" ); case MAILSMTP_ERROR_SERVICE_NOT_AVAILABLE: return i18n( "Service not available" ); case MAILSMTP_ERROR_STREAM: return i18n( "Stream error" ); case MAILSMTP_ERROR_HOSTNAME: return i18n( "gethostname() failed" ); case MAILSMTP_ERROR_NOT_IMPLEMENTED: return i18n( "Not implemented" ); @@ -114,33 +119,33 @@ bool SMTPwrapper::smtpSend( mailmime *mail,bool later) { msg = mime_message_init(mail); mime_message_set_tmpdir(msg,getenv( "HOME" )); int r = mailmessage_fetch(msg,&data,&size); mime_message_detach_mime(msg); mailmessage_free(msg); if (r != MAIL_NO_ERROR || !data) { if (data) free(data); qDebug("Error fetching mime... "); return false; } msg = 0; if (later) { storeMail(data,size,"Outgoing"); if (data) free( data ); - Config cfg( "mail" ); + KConfig cfg( locateLocal("config", "kopiemail" ) ); cfg.setGroup( "Status" ); cfg.writeEntry( "outgoing", ++m_queuedMail ); emit queuedMails( m_queuedMail ); return true; } from = getFrom( mail ); rcpts = createRcptList( mail->mm_data.mm_message.mm_fields ); bool result = smtpSend(from,rcpts,data,size); if (data) { free(data); } if (from) { free(from); } if (rcpts) smtp_address_list_free( rcpts ); @@ -434,28 +439,28 @@ bool SMTPwrapper::flushOutbox() { while (mailsToSend.count()>0) { if (sendQueuedMail(wrap, (*mailsToSend.begin()))==0) { QMessageBox::critical(0,i18n("Error sending mail"), i18n("Error sending queued mail - breaking")); returnValue = false; break; } mailsToRemove.append((*mailsToSend.begin())); mailsToSend.remove(mailsToSend.begin()); sendProgress->setCurrentMails(mailsToRemove.count()); } if (reset_user_value) { m_SmtpAccount->setUser(oldUser); m_SmtpAccount->setPassword(oldPw); } - Config cfg( "mail" ); + KConfig cfg( locateLocal("config", "kopiemail" ) ); cfg.setGroup( "Status" ); m_queuedMail = 0; cfg.writeEntry( "outgoing", m_queuedMail ); emit queuedMails( m_queuedMail ); sendProgress->hide(); delete sendProgress; sendProgress = 0; wrap->deleteMails(mbox,mailsToRemove); delete wrap; return returnValue; } diff --git a/kmicromail/libmailwrapper/smtpwrapper.h b/kmicromail/libmailwrapper/smtpwrapper.h index ec42b56..bdca000 100644 --- a/kmicromail/libmailwrapper/smtpwrapper.h +++ b/kmicromail/libmailwrapper/smtpwrapper.h @@ -1,21 +1,21 @@ // -*- Mode: C++; -*- #ifndef SMTPwrapper_H #define SMTPwrapper_H -#include <qpe/applnk.h> +//#include <qpe/applnk.h> #include <qbitarray.h> #include <qdatetime.h> #include <libetpan/clist.h> #include "settings.h" #include "generatemail.h" #include <opie2/osmartpointer.h> class SMTPaccount; class AbstractMail; class SMTPwrapper : public Generatemail { Q_OBJECT diff --git a/kmicromail/libmailwrapper/storemail.h b/kmicromail/libmailwrapper/storemail.h index 4433de0..e449f57 100644 --- a/kmicromail/libmailwrapper/storemail.h +++ b/kmicromail/libmailwrapper/storemail.h @@ -1,20 +1,20 @@ #ifndef __STORE_MAIL_H #define __STORE_MAIL_H -#include <qpe/applnk.h> +//#include <qpe/applnk.h> #include "generatemail.h" class Account; class Mail; class AbstractMail; class Storemail : public Generatemail { Q_OBJECT public: Storemail(Account*aAccount,const QString&aFolder); Storemail(const QString&dir,const QString&aFolder); Storemail(const QString&aFolder); virtual ~Storemail(); |