Bug 261016 - Identity signature added twice
Summary: Identity signature added twice
Status: CLOSED FIXED
Alias: None
Product: KMail Mobile
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-22 23:51 UTC by Sabine Faure
Modified: 2010-12-23 22:52 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Identity signature inserted twice when selecting an identity from the composer. (32.87 KB, image/png)
2010-12-22 23:52 UTC, Sabine Faure
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sabine Faure 2010-12-22 23:51:07 UTC
Version:           unspecified (using Devel) 
OS:                Linux

When selecting an identity from the composer the signature associated to the identity is added twice for some reason.

This is a regression as it worked fine before (see second screenshot in bug #250608)

Reproducible: Always

Steps to Reproduce:
- Launch Kmail-mobile
- Open the 'Actions' tab
- Click on 'Identities'
- Select an already existing identity
- Click on 'Modify' button
- Click on the 'Signature' tab
- Check the 'Enable signature' check box
- Select 'Input Field Below' from the 'Obtain siganture text from:' combo box
- Type a couple of line in the line edit underneath (ex: Name Surname, work description)
- Click on 'ok' twice
- Click on 'Write new Email'
- Select the identity you've modified from the 'Identity:' combo box

Actual Results:  
The signature is added twice instead of once (see snapshot enclosed).

Expected Results:  
The signature should only be added once.

Note: I've tested this bug both not using and using html formatting and in both cases the bug happens.

N900, 4:4.6~20101222.1208531-1maemo1.1208558
Comment 1 Sabine Faure 2010-12-22 23:52:38 UTC
Created attachment 55175 [details]
Identity signature inserted twice when selecting an identity from the composer.

The signature should only be inserted once.

N900, 4:4.6~20101222.1208531-1maemo1.1208558
Comment 2 Tobias Koenig 2010-12-23 10:25:26 UTC
commit 7075946cef95a33ec2df67743ab08cec9a388dd1
branch master
Author: Tobias Koenig <tokoe@kde.org>
Date:   Thu Dec 23 10:25:44 2010 +0100

    Do not trigger signature replacement twice
    
    Both, the signature controller and the ComposerView::identityChanged
    slot will update the signature if the identity has been changed.
    To prevent this disable identity tracking in signature controller (via suspend())
    and let Message::ComposerViewBase::identityChanged handle the signature update.
    
    BUG: 261016

diff --git a/mobile/mail/composerview.cpp b/mobile/mail/composerview.cpp
index 2308402..c1d19f5 100644
--- a/mobile/mail/composerview.cpp
+++ b/mobile/mail/composerview.cpp
@@ -61,6 +61,7 @@
 #include <KCMultiDialog>
 #include <KNotification>
 
+#include <QtCore/QTimer>
 #include <qdeclarativecontext.h>
 #include <qdeclarativeengine.h>
 
@@ -264,9 +265,17 @@ void ComposerView::qmlLoaded ( QDeclarativeView::Status status )
   Message::SignatureController *signatureController = new Message::SignatureController( this );
   signatureController->setEditor( m_composerBase->editor() );
   signatureController->setIdentityCombo( m_composerBase->identityCombo() );
-  signatureController->applyCurrentSignature();
+  signatureController->suspend(); // ComposerView::identityChanged will update the signature
   m_composerBase->setSignatureController( signatureController );
 
+  if ( MessageComposer::MessageComposerSettings::self()->autoTextSignature() == QLatin1String( "auto" ) ) {
+    if ( MessageComposer::MessageComposerSettings::self()->prependSignature() ) {
+      QTimer::singleShot( 0, m_composerBase->signatureController(), SLOT( prependSignature() ) );
+    } else {
+      QTimer::singleShot( 0, m_composerBase->signatureController(), SLOT( appendSignature() ) );
+    }
+  }
+
   connect( actionCollection()->action( "composer_clean_spaces" ), SIGNAL(triggered(bool)), signatureController, SLOT( cleanSpace() ) );
   connect( actionCollection()->action( "composer_append_signature" ), SIGNAL(triggered(bool)), signatureController, SLOT( appendSignature() ) );
   connect( actionCollection()->action( "composer_prepend_signature" ), SIGNAL(triggered(bool)), signatureController, SLOT( prependSignature() ) );
Comment 3 Sabine Faure 2010-12-23 22:52:33 UTC
It is corrected now.

The signature is only added once now, both when not using and using html formatting so I am closing this bug.

N900, 4:4.6~.20101223.2034.git9cc0c3e-1maemo1.120883