[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/akonadi-ports/kdepim
From:       Leo Franchi <lfranchi () kde ! org>
Date:       2009-12-01 23:03:51
Message-ID: 1259708631.333985.10502.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1057304 by lfranchi:

really save and restore crypto settings.


 M  +20 -9     kmail/kmcomposewin.cpp  
 M  +1 -1      kmail/kmcomposewin.h  
 M  +12 -0     messagecomposer/infopart.cpp  
 M  +4 -1      messagecomposer/infopart.h  
 M  +6 -0      messagecomposer/skeletonmessagejob.cpp  
 M             messagecomposer/tests/gnupg_home/random_seed  


--- branches/work/akonadi-ports/kdepim/kmail/kmcomposewin.cpp #1057303:1057304
@@ -1675,12 +1675,13 @@
 
   // if these headers are present, the state of the message should be overruled
   if ( mMsg->headerByType( "X-KMail-SignatureActionEnabled" ) )
-    mLastSignActionState = (mMsg->headerByType( "X-KMail-SignatureActionEnabled" \
)->as7BitString() == "true"); +    mLastSignActionState = (mMsg->headerByType( \
"X-KMail-SignatureActionEnabled" )->as7BitString().contains( "true" ));  if ( \
                mMsg->headerByType( "X-KMail-EncryptActionEnabled" ) )
-    mLastEncryptActionState = (mMsg->headerByType( "X-KMail-EncryptActionEnabled" \
                )->as7BitString() == "true");
-  if ( mMsg->headerByType( "X-KMail-CryptoMessageFormat" ) )
+    mLastEncryptActionState = (mMsg->headerByType( "X-KMail-EncryptActionEnabled" \
)->as7BitString().contains( "true") ); +  if ( mMsg->headerByType( \
                "X-KMail-CryptoMessageFormat" ) ) {
     mCryptoModuleAction->setCurrentItem( format2cb( \
                static_cast<Kleo::CryptoMessageFormat>(
                     mMsg->headerByType( "X-KMail-CryptoMessageFormat" \
)->asUnicodeString().toInt() ) ) ); +  }
 
   mLastIdentityHasSigningKey = !ident.pgpSigningKey().isEmpty() || \
!ident.smimeSigningKey().isEmpty();  mLastIdentityHasEncryptionKey = \
!ident.pgpEncryptionKey().isEmpty() || !ident.smimeEncryptionKey().isEmpty(); @@ \
-2022,9 +2023,9 @@  }
 
 //-----------------------------------------------------------------------------
-void KMComposeWin::readyForSending( bool neverEncrypt )
+void KMComposeWin::readyForSending( bool noCrypto )
 {
-  kDebug() << "Entering";
+  kDebug() << "Entering, noCrypto:" << noCrypto;
 
   if(!mMsg) {
     kDebug() << "mMsg == 0!";
@@ -2042,7 +2043,7 @@
   // we first figure out if we need to create multiple messages with different \
crypto formats  // if so, we create a composer per format
   // if we aren't signing or encrypting, this just returns a single empty message
-  if( neverEncrypt ) {
+  if( noCrypto ) {
     mComposers.append( new Message::Composer );
   } else {
     mComposers = generateCryptoMessages( mSignAction->isChecked(), \
mEncryptAction->isChecked() ); @@ -2058,7 +2059,7 @@
     fillGlobalPart( composer->globalPart() );
     fillTextPart( composer->textPart() );
     fillInfoPart( composer->infoPart() );
-
+    
     composer->addAttachmentParts( mAttachmentModel->attachments() );
 
     connect( composer, SIGNAL(result(KJob*)), this, \
SLOT(slotSendComposeResult(KJob*)) ); @@ -2270,6 +2271,16 @@
   infoPart->setCc( cc );
   infoPart->setBcc( bcc );
   infoPart->setSubject( subject() );
+
+  KMime::Headers::Base::List extras;
+  if( mMsg->headerByType( "X-KMail-SignatureActionEnabled" ) )
+    extras << mMsg->headerByType( "X-KMail-SignatureActionEnabled" );
+  if( mMsg->headerByType( "X-KMail-EncryptActionEnabled" ) )
+    extras << mMsg->headerByType( "X-KMail-EncryptActionEnabled" );
+  if( mMsg->headerByType( "X-KMail-CryptoMessageFormat" ) )
+    extras << mMsg->headerByType( "X-KMail-CryptoMessageFormat" );
+  
+  infoPart->setExtraHeaders( extras );
 }
 
 void KMComposeWin::slotSendComposeResult( KJob *job )
@@ -3208,7 +3219,7 @@
   mMsg->date()->setDateTime( KDateTime::currentLocalDateTime() );
   mMsg->setHeader( new KMime::Headers::Generic( "X-KMail-Transport", mMsg.get(), \
mTransport->currentText(), "utf-8" ) );  
-  const bool neverEncrypt = ( GlobalSettings::self()->neverEncryptDrafts() ) ||
+  const bool neverEncrypt = ( saveIn != KMComposeWin::None && \
GlobalSettings::self()->neverEncryptDrafts() ) ||  \
mSigningAndEncryptionExplicitlyDisabled;  
   // Save the quote prefix which is used for this message. Each message can have
@@ -3268,7 +3279,7 @@
   }
 
   kDebug() << "Calling applyChanges()";
-  readyForSending( neverEncrypt ); // TODO rename and separate logic for \
print/sent/autosave +  readyForSending( neverEncrypt );
 }
 
 bool KMComposeWin::saveDraftOrTemplate( const QString &folderName,
--- branches/work/akonadi-ports/kdepim/kmail/kmcomposewin.h #1057303:1057304
@@ -507,7 +507,7 @@
      * and signs/encrypts the message if activated.
      * Disables the controls of the composer window.
      */
-    void readyForSending( bool neverEncrypt = false );
+    void readyForSending( bool noCrypto = false );
     /**
      * Applies the user changes to the message object, but doesn't
      * sign nor decrypt, and doesn't disable the controls of the
--- branches/work/akonadi-ports/kdepim/messagecomposer/infopart.cpp #1057303:1057304
@@ -31,6 +31,7 @@
     QString subject;
     QString fcc;
     int transportId;
+    KMime::Headers::Base::List extraHeaders;
 };
 
 InfoPart::InfoPart( QObject *parent )
@@ -115,4 +116,15 @@
   return d->fcc;
 }
 
+void InfoPart::setExtraHeaders( KMime::Headers::Base::List headers )
+{
+  d->extraHeaders = headers;
+}
+
+KMime::Headers::Base::List InfoPart::extraHeaders() const
+{
+  return d->extraHeaders;
+}
+    
+
 #include "infopart.moc"
--- branches/work/akonadi-ports/kdepim/messagecomposer/infopart.h #1057303:1057304
@@ -25,6 +25,7 @@
 #include <QtCore/QStringList>
 
 #include <kmime/kmime_message.h>
+#include <kmime/kmime_headers.h>
 #include <boost/shared_ptr.hpp>
 
 namespace Message {
@@ -49,10 +50,12 @@
     QString subject() const;
     void setSubject( const QString &subject );
 
-
     QString fcc() const;
     void setFcc( const QString &fcc );
 
+    void setExtraHeaders( KMime::Headers::Base::List headers );
+    KMime::Headers::Base::List extraHeaders() const;
+    
     int transportId() const;
     void setTransportId( int tid );
 
--- branches/work/akonadi-ports/kdepim/messagecomposer/skeletonmessagejob.cpp \
#1057303:1057304 @@ -116,6 +116,12 @@
     message->setHeader( date );
   }
 
+  // Extras
+
+  foreach( KMime::Headers::Base* extra, infoPart->extraHeaders() ) {
+    message->setHeader( extra );
+  }
+
   q->emitResult(); // Success.
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic