[Bug 263554] Saving a new contact group doesn't close dialog immediately

Tobias Koenig tokoe at kde.org
Wed Jan 19 16:09:03 GMT 2011


https://bugs.kde.org/show_bug.cgi?id=263554


Tobias Koenig <tokoe at kde.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #3 from Tobias Koenig <tokoe kde org>  2011-01-19 17:09:02 ---
commit 629f2adb85b881d46af3531f9a51d10fd167dae4
branch master
Author: Tobias Koenig <tokoe at kde.org>
Date:   Wed Jan 19 17:10:17 2011 +0100

    Disable 'Save' buttons after click

    Since the ContactEditor and ContactGroupEditor might need some
    time to finish saving, we should prevent the user from clicking
    save multiple times, otherwise the contact (group) is created multiple
    times as well.

    BUG: 263554

diff --git a/mobile/contacts/editorcontactgroup.cpp
b/mobile/contacts/editorcontactgroup.cpp
index cac0f4a..0f38c5c 100644
--- a/mobile/contacts/editorcontactgroup.cpp
+++ b/mobile/contacts/editorcontactgroup.cpp
@@ -110,6 +110,11 @@ class EditorContactGroup::Private
       mUi.launchAccountWizardButton->setVisible( !available );
     }

+    void disableSaveButton()
+    {
+      mUi.saveButton->setEnabled( false );
+    }
+
   private:
     void addRows( int newRowCount );
 };
@@ -227,6 +232,7 @@ EditorContactGroup::EditorContactGroup( QWidget *parent )
   connect( d->mUi.addRecipientButton, SIGNAL( clicked() ), SLOT(
addRecipientClicked() ) );

   connect( d->mUi.cancelButton, SIGNAL( clicked() ), SIGNAL( cancelClicked() )
);
+  connect( d->mUi.saveButton, SIGNAL( clicked() ), SLOT( disableSaveButton() )
); // prevent double clicks
   connect( d->mUi.saveButton, SIGNAL( clicked() ), SIGNAL( saveClicked() ) );
   connect( d->mUi.collectionSelector, SIGNAL( currentChanged(
Akonadi::Collection ) ),
            SIGNAL( collectionChanged( Akonadi::Collection ) ) );
diff --git a/mobile/contacts/editorcontactgroup.h
b/mobile/contacts/editorcontactgroup.h
index 156d84f..b147ba3 100644
--- a/mobile/contacts/editorcontactgroup.h
+++ b/mobile/contacts/editorcontactgroup.h
@@ -67,6 +67,7 @@ class EditorContactGroup : public QWidget
     Q_PRIVATE_SLOT( d, void fetchResult( KJob* ) )
     Q_PRIVATE_SLOT( d, void clearRecipientClicked() )
     Q_PRIVATE_SLOT( d, void availableCollectionsChanged() )
+    Q_PRIVATE_SLOT( d, void disableSaveButton() )
 };

 #endif
diff --git a/mobile/contacts/editorgeneral.cpp
b/mobile/contacts/editorgeneral.cpp
index 99ff880..bfe3677 100644
--- a/mobile/contacts/editorgeneral.cpp
+++ b/mobile/contacts/editorgeneral.cpp
@@ -125,6 +125,11 @@ class EditorGeneral::Private
       mUi.launchAccountWizardButton->setVisible( !available );
     }

+    void disableSaveButton()
+    {
+      mUi.saveButton->setEnabled( false );
+    }
+
   private:
     void addEmailRows( int newRowCount );
     void addPhoneRows( int newRowCount );
@@ -341,6 +346,7 @@ EditorGeneral::EditorGeneral( QWidget *parent )

   connect( d->mUi.addPhoneButton, SIGNAL( clicked() ), SLOT( addPhoneClicked()
) );

+  connect( d->mUi.saveButton, SIGNAL( clicked() ), SLOT( disableSaveButton() )
); // prevent double clicks
   connect( d->mUi.saveButton, SIGNAL( clicked() ), SIGNAL( saveClicked() ) );
   connect( d->mUi.cancelButton, SIGNAL( clicked() ), SIGNAL( cancelClicked() )
);
   connect( d->mUi.collectionSelector, SIGNAL( currentChanged(
Akonadi::Collection ) ),
diff --git a/mobile/contacts/editorgeneral.h b/mobile/contacts/editorgeneral.h
index 781c057..c01c8a9 100644
--- a/mobile/contacts/editorgeneral.h
+++ b/mobile/contacts/editorgeneral.h
@@ -66,6 +66,7 @@ class EditorGeneral : public EditorBase
     Q_PRIVATE_SLOT( d, void clearEmailClicked() )
     Q_PRIVATE_SLOT( d, void clearPhoneClicked() )
     Q_PRIVATE_SLOT( d, void availableCollectionsChanged() )
+    Q_PRIVATE_SLOT( d, void disableSaveButton() )
 };

 #endif

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Kdepim-bugs mailing list