kmail

kmsender.h

Go to the documentation of this file.
00001 /*
00002  * kmail: KDE mail client
00003  * Copyright (c) 1996-1998 Stefan Taferner <taferner@kde.org>
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00018  *
00019  */
00020 #ifndef kmsender_h
00021 #define kmsender_h
00022 #include "messagesender.h"
00023 
00024 #ifndef KDE_USE_FINAL
00025 # ifndef REALLY_WANT_KMSENDER
00026 #  error Do not include kmsender.h, but messagesender.h.
00027 # endif
00028 #endif
00029 
00030 #include <qcstring.h>
00031 #include <qstring.h>
00032 #include <qstringlist.h>
00033 #include <qmap.h>
00034 #include <qobject.h>
00035 #include <kdeversion.h>
00036 
00037 class KMMessage;
00038 class KMFolder;
00039 class KMFolderMgr;
00040 class KConfig;
00041 class KProcess;
00042 class KMSendProc;
00043 class KMSendSendmail;
00044 class KMSendSMTP;
00045 class QStrList;
00046 class KMTransportInfo;
00047 class KMPrecommand;
00048 
00049 namespace KPIM {
00050   class ProgressItem;
00051 }
00052 
00053 class KMSender: public QObject, public KMail::MessageSender
00054 {
00055   Q_OBJECT
00056   friend class ::KMSendProc;
00057   friend class ::KMSendSendmail;
00058   friend class ::KMSendSMTP;
00059 
00060 public:
00061   KMSender();
00062   ~KMSender();
00063 
00064 protected:
00072   bool doSend(KMMessage* msg, short sendNow);
00073 
00077   bool doSendQueued( const QString& transport );
00078 
00079 private:
00081   bool sending() const { return mSendInProgress; }
00082 
00083 public:
00086   bool sendImmediate() const { return mSendImmediate; }
00087   void setSendImmediate(bool);
00088 
00091   bool sendQuotedPrintable() const { return mSendQuotedPrintable; }
00092   void setSendQuotedPrintable(bool);
00093 
00094 private:
00096   KMTransportInfo * transportInfo() { return mTransportInfo; }
00097 
00098 public:
00100   void readConfig();
00101 
00103   void writeConfig(bool withSync=true);
00104 
00105 private:
00107   void setStatusMsg(const QString&);
00108 
00110   void setStatusByLink(const KMMessage *aMsg);
00111 
00113   void emitProgressInfo( int currentFileProgress );
00114 
00115 private slots:
00117   void slotPrecommandFinished(bool);
00118 
00119   void slotIdle();
00120 
00122   void slotAbortSend();
00123 
00125   void sendProcStarted(bool success);
00126 
00128   void outboxMsgAdded(int idx);
00129 
00130 private:
00132   void doSendMsg();
00133 
00135   void doSendMsgAux();
00136 
00138   void cleanup();
00139 
00143   bool settingsOk() const;
00144 
00147   KMSendProc* createSendProcFromString( const QString & transport );
00148 
00149   bool runPrecommand( const QString & cmd );
00150 
00151 private:
00152   bool mSendImmediate;
00153   bool mSendQuotedPrintable;
00154   KMTransportInfo *mTransportInfo;
00155   KMPrecommand *mPrecommand;
00156 
00157   QString mCustomTransport;
00158   bool mSentOk, mSendAborted;
00159   QString mErrorMsg;
00160   KMSendProc *mSendProc;
00161   QString mMethodStr;
00162   bool mSendProcStarted;
00163   bool mSendInProgress;
00164   KMFolder *mOutboxFolder;
00165   KMFolder *mSentFolder;
00166   KMMessage * mCurrentMsg;
00167   KPIM::ProgressItem* mProgressItem;
00168   int mSentMessages, mTotalMessages;
00169   int mSentBytes, mTotalBytes;
00170   int mFailedMessages;
00171   QMap<QString,QString> mPasswdCache;
00172 };
00173 
00174 #endif /*kmsender_h*/