From a73d6c8793e2484a09eacbc7fa50ea3ada50e116 Mon Sep 17 00:00:00 2001 From: Till Adam Date: Mon, 20 Aug 2007 11:51:00 +0000 Subject: [PATCH] Forward port of: SVN commit 702320 by tilladam: Make sure to store the state of the crypto actions when saving a mail to drafts, but only if the state of the mail itself should not be used as indication of the state of the actions. This is governd by the option to "never sign and encrypt when saving to drafts" in the security settings. Prokde35-z item 44. svn path=/trunk/KDE/kdepim/; revision=702321 --- kmcomposewin.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/kmcomposewin.cpp b/kmcomposewin.cpp index 33873c9a9..98be5dfd0 100644 --- a/kmcomposewin.cpp +++ b/kmcomposewin.cpp @@ -1838,6 +1838,10 @@ void KMComposeWin::setMsg( KMMessage *newMsg, bool mayAutoSign, break; } + // if these headers are present, the state of the message should be overruled + mLastSignActionState = (mMsg->headerField( "X-KMail-SignatureActionEnabled" ) == "true"); + mLastEncryptActionState = (mMsg->headerField( "X-KMail-EncryptActionEnabled" ) == "true"); + mLastIdentityHasSigningKey = !ident.pgpSigningKey().isEmpty() || !ident.smimeSigningKey().isEmpty(); mLastIdentityHasEncryptionKey = !ident.pgpEncryptionKey().isEmpty() || !ident.smimeEncryptionKey().isEmpty(); @@ -3967,6 +3971,17 @@ void KMComposeWin::doSend( KMail::MessageSender::SendMethod method, } kDebug(5006) <<"KMComposeWin::doSend() - calling applyChanges()"; + + if (neverEncrypt && saveIn != KMComposeWin::None ) { + // we can't use the state of the mail itself, to remember the + // signing and encryption state, so let's add a header instead + mMsg->setHeaderField( "X-KMail-SignatureActionEnabled", mSignAction->isChecked()? "true":"false" ); + mMsg->setHeaderField( "X-KMail-EncryptActionEnabled", mEncryptAction->isChecked()? "true":"false" ); + } else { + mMsg->removeHeaderField( "X-KMail-SignatureActionEnabled" ); + mMsg->removeHeaderField( "X-KMail-EncryptActionEnabled" ); + } + applyChanges( neverEncrypt ); }