homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hscollectionnamestate.cpp
changeset 55 03646e8da489
parent 46 23b5d6a29cce
child 60 30f14686fb04
--- a/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hscollectionnamestate.cpp	Thu May 27 12:46:08 2010 +0300
+++ b/homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hscollectionnamestate.cpp	Fri Jun 11 13:30:16 2010 +0300
@@ -55,7 +55,7 @@
  */
 HsCollectionNameState::HsCollectionNameState(QState *parent) :
     QState(parent),
-    mItemId(0), mCollectionNameDialog(NULL), mFinishedEntered(false)
+    mItemId(0), mCollectionNameDialog(NULL)
 {
     construct();
 }
@@ -76,7 +76,6 @@
 {
     setObjectName(this->parent()->objectName() + "/collectionnamestate");
     connect(this, SIGNAL(exited()), SLOT(cleanUp()));
-
 }
 
 /*!
@@ -93,7 +92,6 @@
     QState::onEntry(event);
 
     mItemId = 0;
-    mFinishedEntered = false;
     if (event->type() == HsMenuEvent::eventType()) {
         HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event);
         QVariantMap data = menuEvent->data();
@@ -115,24 +113,18 @@
 //
 void HsCollectionNameState::dialogFinished(HbAction* finishedAction)
 {
-    if (!mFinishedEntered) {
-        mFinishedEntered = true;
-        if (finishedAction == mCollectionNameDialog->actions().value(0)) {
-            QString newName(mCollectionNameDialog->newName(mCollectionNameDialog->value().toString(), true));
-            if (mItemId) {
-                if (newName != HsMenuService::getName(mItemId)) {
-                    HsMenuService::renameCollection(mItemId, newName);
-                }
-            } else {
-                HsMenuService::createCollection(newName);
+    if (finishedAction == mCollectionNameDialog->actions().value(0)) {
+        QString newName(mCollectionNameDialog->newName(mCollectionNameDialog->value().toString(), true));
+        if (mItemId) {
+            if (newName != HsMenuService::getName(mItemId)) {
+                HsMenuService::renameCollection(mItemId, newName);
             }
+        } else {
+            HsMenuService::createCollection(newName);
         }
-        mCollectionNameDialog = NULL; //set to NULL since this will be deleted atfer close
-        emit exit();
-    } else {
-        // (work-around if more then one action is selected in HbDialog)
-        qWarning("Another signal finished was emited.");
     }
+    mCollectionNameDialog = NULL; //set to NULL since this will be deleted atfer close
+    emit exit();
 }
 
 // ---------------------------------------------------------------------------
@@ -141,6 +133,7 @@
 void HsCollectionNameState::cleanUp()
 {
     if (mCollectionNameDialog) {
+        disconnect(mCollectionNameDialog, SIGNAL(finished(HbAction*)), this, SLOT(dialogFinished(HbAction*)));
         mCollectionNameDialog->close();
         mCollectionNameDialog = NULL;
     }