kmail Library API Documentation

messagecomposer.h

00001 00031 #ifndef MESSAGECOMPOSER_H 00032 #define MESSAGECOMPOSER_H 00033 00034 #include "kmmsgpart.h" 00035 #include "keyresolver.h" 00036 00037 #include <qobject.h> 00038 #include <qvaluevector.h> 00039 00040 #include <mimelib/mediatyp.h> 00041 #include <kpgp.h> 00042 00043 #include <vector> 00044 00045 class KMMessage; 00046 class KMComposeWin; 00047 class CryptPlugWrapper; 00048 00049 class MessageComposerJob; 00050 00051 namespace Kleo { 00052 class KeyResolver; 00053 } 00054 00055 namespace GpgME { 00056 class Key; 00057 } 00058 00059 class MessageComposer : public QObject { 00060 Q_OBJECT 00061 friend class MessageComposerJob; 00062 friend class EncryptMessageJob; 00063 friend class SetLastMessageAsUnencryptedVersionOfLastButOne; 00064 00065 public: 00066 class KeyResolver; 00067 00068 MessageComposer( KMComposeWin* win, const char* name=0 ); 00069 ~MessageComposer(); 00070 00078 void applyChanges( bool disableCrypto ); 00079 00080 QString originalBCC() const { return mBcc; } 00081 00082 void setDisableBreaking( bool b ) { mDisableBreaking = b; } 00083 00084 const QValueVector<KMMessage*> & composedMessageList() const { 00085 return mMessageList; 00086 } 00087 00088 signals: 00089 void done( bool ); 00090 00091 private: 00092 void readFromComposeWin(); 00093 00094 void adjustCryptFlags(); 00095 00096 // This is the composeMessage method 00097 void composeMessage(); 00098 // And these two are the parts that should be run after job completions 00099 void createUnencryptedMessageVersion(); 00100 00108 void composeMessage( KMMessage& theMessage, 00109 bool doSign, bool doEncrypt, 00110 Kleo::CryptoMessageFormat format ); 00111 void continueComposeMessage( KMMessage& theMessage, bool doSign, 00112 bool doEncrypt, 00113 Kleo::CryptoMessageFormat format ); 00114 00118 void composeInlineOpenPGPMessage( KMMessage& theMessage, 00119 bool doSign, bool doEncrypt ); 00120 00125 QCString breakLinesAndApplyCodec(); 00127 QCString bodyText(); 00128 00133 void pgpSignedMsg( const QCString & cText, Kleo::CryptoMessageFormat f ); 00138 Kpgp::Result pgpEncryptedMsg( QByteArray& rEncryptedBody, 00139 const QCString & cText, 00140 const std::vector<GpgME::Key> & encryptionKeys, 00141 Kleo::CryptoMessageFormat f ); 00142 00147 Kpgp::Result pgpSignedAndEncryptedMsg( QByteArray& rEncryptedBody, 00148 const QCString & cText, 00149 const std::vector<GpgME::Key> & signingKeys, 00150 const std::vector<GpgME::Key> & encryptionKeys, 00151 Kleo::CryptoMessageFormat f ); 00152 00156 bool checkForEncryptCertificateExpiry( const QString& recipient, 00157 const QCString& certFingerprint ); 00158 00170 bool processStructuringInfo( const QString bugURL, 00171 const QString contentDescriptionClear, 00172 const QCString contentTypeClear, 00173 const QCString contentSubtypeClear, 00174 const QCString contentDispClear, 00175 const QCString contentTEncClear, 00176 const QCString& bodytext, 00177 const QString contentDescriptionCiph, 00178 const QByteArray& ciphertext, 00179 KMMessagePart& resultingPart, 00180 bool signing, Kleo::CryptoMessageFormat format ); 00181 00182 void encryptMessage( KMMessage* msg, const Kleo::KeyResolver::SplitInfo & si, 00183 bool doSign, bool doEncrypt, 00184 KMMessagePart newBodyPart, 00185 Kleo::CryptoMessageFormat format ); 00186 00187 void addBodyAndAttachments( KMMessage* msg, const Kleo::KeyResolver::SplitInfo & si, 00188 bool doSign, bool doEncrypt, 00189 const KMMessagePart& ourFineBodyPart, 00190 Kleo::CryptoMessageFormat format ); 00191 00192 private slots: 00193 void slotDoNextJob(); 00194 00195 private: 00196 void doNextJob(); 00197 00198 int encryptionPossible( const QStringList & recipients, bool openPGP ); 00199 bool determineWhetherToSign( bool doSignCompletely ); 00200 bool determineWhetherToEncrypt( bool doEncryptCompletely ); 00201 void markAllAttachmentsForSigning( bool sign ); 00202 void markAllAttachmentsForEncryption( bool enc ); 00203 00204 KMComposeWin* mComposeWin; 00205 MessageComposerJob * mCurrentJob; 00206 KMMessage* mReferenceMessage; 00207 QValueVector<KMMessage*> mMessageList; 00208 00209 Kleo::KeyResolver * mKeyResolver; 00210 00211 QCString mSignCertFingerprint; 00212 00213 struct Attachment { 00214 Attachment( KMMessagePart * p=0, bool s=false, bool e=false ) 00215 : part( p ), sign( s ), encrypt( e ) {} 00216 KMMessagePart * part; 00217 bool sign; 00218 bool encrypt; 00219 }; 00220 QValueVector<Attachment> mAttachments; 00221 00222 QString mPGPSigningKey, mSMIMESigningKey; 00223 bool mUseOpportunisticEncryption; 00224 bool mSigningRequested, mEncryptionRequested; 00225 bool mDoSign, mDoEncrypt; 00226 unsigned int mAllowedCryptoMessageFormats; 00227 bool mDisableCrypto; 00228 bool mDisableBreaking; 00229 QString mBcc; 00230 QStringList mTo, mCc, mBccList; 00231 bool mDebugComposerCrypto; 00232 bool mAutoCharset; 00233 QCString mCharset; 00234 bool mRc; // Set this to false, if something fails during the processes 00235 bool mHoldJobs; // Don't run the next job yet 00236 00237 // These are the variables of the big composeMessage(X,Y,Z) message 00238 KMMessagePart* mNewBodyPart; 00239 QByteArray mSignature; 00240 00241 QCString mEncodedBody; // Only needed if signing and/or encrypting 00242 bool mEarlyAddAttachments, mAllAttachmentsAreInBody; 00243 KMMessagePart mOldBodyPart; 00244 int mPreviousBoundaryLevel; 00245 00246 // The boundary is saved for later addition into mp/a body 00247 DwString mSaveBoundary; 00248 00249 QValueList<MessageComposerJob*> mJobs; 00250 }; 00251 00252 #endif /* MESSAGECOMPOSER_H */
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:52:51 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003