homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsdeletecollectionitemstate.cpp
changeset 55 03646e8da489
parent 46 23b5d6a29cce
child 60 30f14686fb04
equal deleted inserted replaced
51:4785f57bf3d4 55:03646e8da489
    64 
    64 
    65 /*!
    65 /*!
    66  Sets entry event.
    66  Sets entry event.
    67  \param event entry event.
    67  \param event entry event.
    68  */
    68  */
    69 #ifdef COVERAGE_MEASUREMENT
       
    70 #pragma CTC SKIP
       
    71 #endif //COVERAGE_MEASUREMENT
       
    72 void HsDeleteCollectionItemState::onEntry(QEvent *event)
    69 void HsDeleteCollectionItemState::onEntry(QEvent *event)
    73 {
    70 {
    74     HSMENUTEST_FUNC_ENTRY("HsDeleteCollectionItemState::onEntry");
    71     HSMENUTEST_FUNC_ENTRY("HsDeleteCollectionItemState::onEntry");
    75     QState::onEntry(event);
    72     QState::onEntry(event);
    76     qDebug("CollectionState::onEntry()");
    73     qDebug("CollectionState::onEntry()");
   100 
    97 
   101     mDeleteMessage->open(this, SLOT(deleteMessageFinished(HbAction*)));
    98     mDeleteMessage->open(this, SLOT(deleteMessageFinished(HbAction*)));
   102 
    99 
   103     HSMENUTEST_FUNC_EXIT("HsDeleteCollectionItemState::onEntry");
   100     HSMENUTEST_FUNC_EXIT("HsDeleteCollectionItemState::onEntry");
   104 }
   101 }
   105 #ifdef COVERAGE_MEASUREMENT
       
   106 #pragma CTC ENDSKIP
       
   107 #endif //COVERAGE_MEASUREMENT
       
   108 
   102 
   109 // ---------------------------------------------------------------------------
   103 /*!
   110 // ---------------------------------------------------------------------------
   104  Action after closed confirmation dialog.
   111 //
   105  \param finishedAction chosen action.
       
   106  \retval void
       
   107  */
   112 void HsDeleteCollectionItemState::deleteMessageFinished(HbAction* finishedAction)
   108 void HsDeleteCollectionItemState::deleteMessageFinished(HbAction* finishedAction)
   113 {
   109 {
   114     if (mItemId !=0 ) { // (work-around for crash if more then one action is selected in HbDialog)
   110     if (finishedAction == mConfirmAction) {
   115 
   111         HsMenuService::removeApplicationFromCollection(mItemId, mCollectionId);
   116         if (finishedAction == mConfirmAction) {
       
   117             HsMenuService::removeApplicationFromCollection(mItemId, mCollectionId);
       
   118         }
       
   119         mItemId = 0;
       
   120         emit exit();
       
   121     } else {
       
   122         // (work-around for crash if more then one action is selected in HbDialog)
       
   123         qWarning("Another signal finished was emited.");
       
   124     }
   112     }
       
   113     emit exit();
   125 }
   114 }
   126 
   115 
   127 /*!
   116 /*!
   128  Slot launched after state has exited and in destructor.
   117  Slot launched after state has exited and in destructor.
   129  \retval void
   118  \retval void
   130  */
   119  */
   131 void HsDeleteCollectionItemState::cleanUp()
   120 void HsDeleteCollectionItemState::cleanUp()
   132 {
   121 {
   133     // Close messagebox if App key was pressed
   122     // Close messagebox if App key was pressed
   134     if (mDeleteMessage) {
   123     if (mDeleteMessage) {
       
   124 		disconnect(mDeleteMessage, SIGNAL(finished(HbAction*)), this, SLOT(deleteMessageFinished(HbAction*)));
   135         mDeleteMessage->close();
   125         mDeleteMessage->close();
       
   126 		mDeleteMessage = NULL;
   136     }
   127     }
   137 
   128 	
   138     mDeleteMessage = NULL;
   129     mConfirmAction = NULL;
   139     mConfirmAction= NULL;
       
   140     mItemId = 0;
   130     mItemId = 0;
   141     mCollectionId = 0;
   131     mCollectionId = 0;
   142 }
   132 }