Bug 103240

Summary: Draft messages forget the default GPG action
Product: [Applications] kmail Reporter: Adam Jackson <ajax>
Component: encryptionAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.8   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:

Description Adam Jackson 2005-04-04 23:32:44 UTC
Version:           1.8 (using KDE KDE 3.4.0)
Installed from:    Gentoo Packages
Compiler:          gcc 3.4.3 
OS:                Linux

If you have GPG signing enabled by default, but save a message to the Drafts folder: when you go to edit the message again, encryption and signature buttons are off.  If you send the message without remembering to click on the Sign or Encrypt buttons it will be sent plaintext, even if this is not your default action.
Comment 1 Adam Porter 2006-06-04 04:47:40 UTC
In Debian as: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=364008
Comment 2 Benoni José 2006-07-08 18:03:24 UTC
I have the same problem under SuSE 10.1 (KMail 1.9.1).  Really took me by supprise ; at least it was only a signed message and not an encrypted one.

Benoni
Comment 3 eikes 2006-07-25 12:46:06 UTC
*** This bug has been confirmed by popular vote. ***
Comment 4 Thomas McGuire 2007-07-10 17:50:38 UTC
See also bug 92969.
Comment 5 Alexis Papadopoulos 2007-08-16 15:15:28 UTC
Just posting here a notice that a patch awaits review on that issue, since this issue kind of disturbed me too...

http://lists.kde.org/?l=kde-pim&m=118303963630786&w=2

If something is wrong, I can try and fix it so keep in touch, either through the ML or here...

Cheers,
acp
Comment 6 Till Adam 2007-08-20 13:45:46 UTC
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.
BUG: 103240



 M  +15 -0     kmcomposewin.cpp  


--- branches/kdepim/enterprise/kdepim/kmail/kmcomposewin.cpp #702319:702320
@@ -1835,6 +1835,10 @@
       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();
 
@@ -4010,6 +4014,17 @@
     }
   }
 
+  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" );
+  }
+
+
   kdDebug(5006) << "KMComposeWin::doSend() - calling applyChanges()"
                 << endl;
   applyChanges( neverEncrypt );