kmail

kmsender.h

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 <qobject.h>
00034 #include <kdeversion.h>
00035 
00036 class KMMessage;
00037 class KMFolder;
00038 class KMFolderMgr;
00039 class KConfig;
00040 class KProcess;
00041 class KMSendProc;
00042 class KMSendSendmail;
00043 class KMSendSMTP;
00044 class QStrList;
00045 class KMTransportInfo;
00046 class KMPrecommand;
00047 
00048 namespace KPIM {
00049   class ProgressItem;
00050 }
00051 
00052 class KMSender: public QObject, public KMail::MessageSender
00053 {
00054   Q_OBJECT
00055   friend class ::KMSendProc;
00056   friend class ::KMSendSendmail;
00057   friend class ::KMSendSMTP;
00058 
00059 public:
00060   KMSender();
00061   ~KMSender();
00062 
00063 protected:
00071   bool doSend(KMMessage* msg, short sendNow);
00072 
00076   bool doSendQueued( const QString& transport );
00077 
00078 private:
00080   bool sending() const { return mSendInProgress; }
00081 
00082 public:
00085   bool sendImmediate() const { return mSendImmediate; }
00086   void setSendImmediate(bool);
00087 
00090   bool sendQuotedPrintable() const { return mSendQuotedPrintable; }
00091   void setSendQuotedPrintable(bool);
00092 
00093 private:
00095   KMTransportInfo * transportInfo() { return mTransportInfo; }
00096 
00097 public:
00099   void readConfig();
00100 
00102   void writeConfig(bool withSync=TRUE);
00103 
00104 private:
00106   void setStatusMsg(const QString&);
00107 
00109   void setStatusByLink(const KMMessage *aMsg);
00110 
00112   void emitProgressInfo( int currentFileProgress );
00113 
00114 private slots:
00116   void slotPrecommandFinished(bool);
00117 
00118   void slotIdle();
00119 
00121   void slotAbortSend();
00122 
00124   void sendProcStarted(bool success);
00125 
00127   void outboxMsgAdded(int idx);
00128 
00129 private:
00131   void doSendMsg();
00132 
00134   void doSendMsgAux();
00135 
00137   void cleanup();
00138 
00142   bool settingsOk() const;
00143 
00146   KMSendProc* createSendProcFromString( const QString & transport );
00147 
00148   bool runPrecommand( const QString & cmd );
00149 
00150 private:
00151   bool mSendImmediate;
00152   bool mSendQuotedPrintable;
00153   KMTransportInfo *mTransportInfo;
00154   KMPrecommand *mPrecommand;
00155 
00156   QString mCustomTransport;
00157   bool mSentOk, mSendAborted;
00158   QString mErrorMsg;
00159   KMSendProc *mSendProc;
00160   QString mMethodStr;
00161   bool mSendProcStarted;
00162   bool mSendInProgress;
00163   KMFolder *mOutboxFolder;
00164   KMFolder *mSentFolder;
00165   KMMessage * mCurrentMsg;
00166   KPIM::ProgressItem* mProgressItem;
00167   int mSentMessages, mTotalMessages;
00168   int mSentBytes, mTotalBytes;
00169   int mFailedMessages;
00170 };
00171 
00172 #endif /*kmsender_h*/
KDE Home | KDE Accessibility Home | Description of Access Keys