homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsdeletecollectionitemstate.cpp
changeset 63 52b0f64eeb51
parent 62 341166945d65
child 81 7dd137878ff8
equal deleted inserted replaced
62:341166945d65 63:52b0f64eeb51
    13  *
    13  *
    14  * Description: Menu delete collection item state
    14  * Description: Menu delete collection item state
    15  *
    15  *
    16  */
    16  */
    17 
    17 
    18 #include <hbmessagebox.h>
    18 #include <HbMessageBox>
    19 #include <hbaction.h>
    19 #include <hbaction.h>
    20 #include <HbParameterLengthLimiter>
    20 #include <HbParameterLengthLimiter>
    21 #include <hsmenuservice.h>
    21 #include <hsmenuservice.h>
    22 #include <hsmenueventfactory.h>
    22 #include <hsmenueventfactory.h>
    23 
    23 
       
    24 #include "hsmenudialogfactory.h"
    24 #include "hsdeletecollectionitemstate.h"
    25 #include "hsdeletecollectionitemstate.h"
    25 #include "hsmenuevent.h"
    26 #include "hsmenuevent.h"
    26 
    27 
    27 /*!
    28 /*!
    28  \class HsDeleteCollectionItemState
    29  \class HsDeleteCollectionItemState
    84     message.append(
    85     message.append(
    85         HbParameterLengthLimiter("txt_applib_dialog_remove_1_from_collection").arg(
    86         HbParameterLengthLimiter("txt_applib_dialog_remove_1_from_collection").arg(
    86             HsMenuService::getName(mItemId)));
    87             HsMenuService::getName(mItemId)));
    87 
    88 
    88     // create and show message box
    89     // create and show message box
    89     mDeleteMessage = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
    90     mDeleteMessage = HsMenuDialogFactory().create(message);
    90     mDeleteMessage->setAttribute(Qt::WA_DeleteOnClose);
    91     mConfirmAction = mDeleteMessage->actions().value(0);
    91 
       
    92     mDeleteMessage->setText(message);
       
    93 
       
    94     mDeleteMessage->clearActions();
       
    95     mConfirmAction = new HbAction(hbTrId("txt_common_button_ok"), mDeleteMessage);
       
    96     mDeleteMessage->addAction(mConfirmAction);
       
    97 
       
    98     HbAction *secondaryAction = new HbAction(hbTrId("txt_common_button_cancel"), mDeleteMessage);
       
    99     mDeleteMessage->addAction(secondaryAction);
       
   100 
       
   101     mDeleteMessage->open(this, SLOT(deleteMessageFinished(HbAction*)));
    92     mDeleteMessage->open(this, SLOT(deleteMessageFinished(HbAction*)));
   102 
    93 
   103     HSMENUTEST_FUNC_EXIT("HsDeleteCollectionItemState::onEntry");
    94     HSMENUTEST_FUNC_EXIT("HsDeleteCollectionItemState::onEntry");
   104 }
    95 }
   105 
    96 
   108  \param finishedAction chosen action.
    99  \param finishedAction chosen action.
   109  \retval void
   100  \retval void
   110  */
   101  */
   111 void HsDeleteCollectionItemState::deleteMessageFinished(HbAction* finishedAction)
   102 void HsDeleteCollectionItemState::deleteMessageFinished(HbAction* finishedAction)
   112 {
   103 {
   113     if (finishedAction == mConfirmAction) {
   104     if (static_cast<QAction*>(finishedAction) == mConfirmAction) {
   114         HsMenuService::removeApplicationFromCollection(mItemId, mCollectionId);
   105         HsMenuService::removeApplicationFromCollection(mItemId, mCollectionId);
   115     }
   106     }
   116     emit exit();
   107     emit exit();
       
   108     mConfirmAction = NULL;
   117 }
   109 }
   118 
   110 
   119 /*!
   111 /*!
   120  Slot launched after state has exited and in destructor.
   112  Slot launched after state has exited and in destructor.
   121  \retval void
   113  \retval void