Bug 256970

Summary: Failed Account setup leaves new identity
Product: KDE PIM Mobile Reporter: Andre Heinecke <aheinecke>
Component: generalAssignee: Ludwig Reiter <ludwig.reiter>
Status: VERIFIED FIXED    
Severity: normal CC: tokoe
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Windows CE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Andre Heinecke 2010-11-15 12:57:39 UTC
If the Accountwizzard fails somewhere (like failing to add an IMAP account) the identity is still created and shows up in the list of idenities.
Comment 1 Tobias Koenig 2010-12-28 10:21:16 UTC
commit 51b1a0fc97c97fdb4fd2251f9e6a42190784d04c
branch master
Author: Tobias Koenig <tokoe@kde.org>
Date:   Tue Dec 28 10:21:03 2010 +0100

    Remove the identity from IdentityManager on rollback
    
    We can't use IdentityManager::rollback() here, because in Identity::create()
    IdentityManager::commit() is called and therefor no transaction available to
    rollback. So remove the identity explicitly in its own transaction.
    
    CCBUG: 256970

diff --git a/accountwizard/identity.cpp b/accountwizard/identity.cpp
index 8bb5dc0..d9f6a72 100644
--- a/accountwizard/identity.cpp
+++ b/accountwizard/identity.cpp
@@ -81,8 +81,9 @@ QString Identity::identityName() const
 
 void Identity::destroy()
 {
+  m_manager->removeIdentity( m_identity->identityName() );
+  m_manager->commit();
   m_identity = 0;
-  m_manager->rollback();
   emit info( i18n( "Identity removed." ) );
 }
Comment 2 Tobias Koenig 2010-12-28 10:25:59 UTC
Hej Andre,

can you retest this bug, please?
If you have one identity already and the setup of a second account with a different identity fails, the second identity should be removed correctly now. However if you create the initial identity on a clean account setup, we can't remove the identity again, because the IdentityManager class currently doesn't allow us to remove the last remaining identity. Will discuss this with the other pim developers.

Ciao,
Tobias
Comment 3 Tobias Koenig 2010-12-28 11:09:24 UTC
commit eefd0a76766724d66e8913b5f8a806a3bb1f2a5e
branch master
Author: Tobias Koenig <tokoe@kde.org>
Date:   Tue Dec 28 11:12:42 2010 +0100

    Allow to remove the last remaining identity on rollback
    
    BUG: 256970

diff --git a/accountwizard/identity.cpp b/accountwizard/identity.cpp
index d9f6a72..825b467 100644
--- a/accountwizard/identity.cpp
+++ b/accountwizard/identity.cpp
@@ -81,7 +81,7 @@ QString Identity::identityName() const
 
 void Identity::destroy()
 {
-  m_manager->removeIdentity( m_identity->identityName() );
+  m_manager->removeIdentityForced( m_identity->identityName() );
   m_manager->commit();
   m_identity = 0;
   emit info( i18n( "Identity removed." ) );
Comment 4 Ludwig Reiter 2011-02-24 11:44:45 UTC
Kontact Touch Windows CE 2011-02-22 9:20

In test with failed add account, the new account identity was not added to ids.
So okay.