31 #ifndef MESSAGECOMPOSER_H
32 #define MESSAGECOMPOSER_H
34 #include "kmmsgpart.h"
35 #include "keyresolver.h"
38 #include <tqvaluevector.h>
40 #include <mimelib/mediatyp.h>
41 #include <kleo/cryptobackend.h>
49 class MessageComposerJob;
50 class EncryptMessageJob;
51 class SetLastMessageAsUnencryptedVersionOfLastButOne;
65 class MessageComposer :
public TQObject {
68 friend class ::MessageComposerJob;
69 friend class ::EncryptMessageJob;
70 friend class ::SetLastMessageAsUnencryptedVersionOfLastButOne;
75 MessageComposer( KMComposeWin* win,
const char* name=0 );
85 void applyChanges(
bool disableCrypto );
87 TQString originalBCC()
const {
return mBcc; }
89 void setDisableBreaking(
bool b ) { mDisableBreaking = b; }
91 const TQValueVector<KMMessage*> & composedMessageList()
const {
95 bool isPerformingSignOperation()
const {
return mPerformingSignOperation; }
100 void readFromComposeWin();
102 void adjustCryptFlags();
104 bool encryptWithChiasmus(
const Kleo::CryptoBackend::Protocol * chiasmus,
105 const TQByteArray& body,
106 TQByteArray& resultData );
107 void chiasmusEncryptAllAttachments();
108 void composeChiasmusMessage(
KMMessage& theMessage, Kleo::CryptoMessageFormat format );
111 void composeMessage();
113 void createUnencryptedMessageVersion();
122 void composeMessage(
KMMessage& theMessage,
123 bool doSign,
bool doEncrypt,
124 Kleo::CryptoMessageFormat format );
125 void continueComposeMessage(
KMMessage& theMessage,
bool doSign,
127 Kleo::CryptoMessageFormat format );
132 void composeInlineOpenPGPMessage(
KMMessage& theMessage,
133 bool doSign,
bool doEncrypt );
139 TQByteArray breakLinesAndApplyCodec();
145 TQCString plainTextFromMarkup(
const TQString& markupText );
151 void pgpSignedMsg(
const TQByteArray& cText, Kleo::CryptoMessageFormat f );
156 Kpgp::Result pgpEncryptedMsg( TQByteArray& rEncryptedBody,
157 const TQByteArray& cText,
158 const std::vector<GpgME::Key> & encryptionKeys,
159 Kleo::CryptoMessageFormat f );
165 Kpgp::Result pgpSignedAndEncryptedMsg( TQByteArray& rEncryptedBody,
166 const TQByteArray& cText,
167 const std::vector<GpgME::Key> & signingKeys,
168 const std::vector<GpgME::Key> & encryptionKeys,
169 Kleo::CryptoMessageFormat f );
174 bool checkForEncryptCertificateExpiry(
const TQString& recipient,
175 const TQCString& certFingerprint );
188 bool processStructuringInfo(
const TQString bugURL,
189 const TQString contentDescriptionClear,
190 const TQCString contentTypeClear,
191 const TQCString contentSubtypeClear,
192 const TQCString contentDispClear,
193 const TQCString contentTEncClear,
194 const TQByteArray& bodytext,
195 const TQString contentDescriptionCiph,
196 const TQByteArray& ciphertext,
197 KMMessagePart& resultingPart,
198 bool signing, Kleo::CryptoMessageFormat format );
200 void encryptMessage(
KMMessage* msg,
const Kleo::KeyResolver::SplitInfo & si,
201 bool doSign,
bool doEncrypt,
202 KMMessagePart newBodyPart,
203 Kleo::CryptoMessageFormat format );
205 void addBodyAndAttachments(
KMMessage* msg,
const Kleo::KeyResolver::SplitInfo & si,
206 bool doSign,
bool doEncrypt,
207 const KMMessagePart& ourFineBodyPart,
208 Kleo::CryptoMessageFormat format );
211 void slotDoNextJob();
215 void emitDone(
bool ok );
217 int encryptionPossible(
const TQStringList & recipients,
bool openPGP );
218 bool determineWhetherToSign(
bool doSignCompletely );
219 bool determineWhetherToEncrypt(
bool doEncryptCompletely );
220 void markAllAttachmentsForSigning(
bool sign );
221 void markAllAttachmentsForEncryption(
bool enc );
223 KMComposeWin* mComposeWin;
224 MessageComposerJob * mCurrentJob;
226 TQValueVector<KMMessage*> mMessageList;
230 TQCString mSignCertFingerprint;
233 Attachment( KMMessagePart * p=0,
bool s=
false,
bool e=
false )
234 : part( p ), sign( s ), encrypt( e ) {}
235 KMMessagePart * part;
239 TQValueVector<Attachment> mAttachments;
241 TQString mPGPSigningKey, mSMIMESigningKey;
242 bool mUseOpportunisticEncryption;
243 bool mSignBody, mEncryptBody;
244 bool mSigningRequested, mEncryptionRequested;
245 bool mDoSign, mDoEncrypt;
246 unsigned int mAllowedCryptoMessageFormats;
248 bool mDisableBreaking;
250 TQStringList mTo, mCc, mBccList;
251 bool mDebugComposerCrypto;
260 unsigned int mLineBreakColumn;
263 KMMessagePart* mNewBodyPart;
264 TQByteArray mSignature;
266 TQByteArray mEncodedBody;
267 bool mEarlyAddAttachments, mAllAttachmentsAreInBody;
268 KMMessagePart mOldBodyPart;
269 int mPreviousBoundaryLevel;
272 DwString mSaveBoundary;
273 TQCString mMultipartMixedBoundary;
275 TQValueList<MessageComposerJob*> mJobs;
276 bool mEncryptWithChiasmus;
277 bool mPerformingSignOperation;
A class to resolve signing/encryption keys w.r.t.