homescreenapp/stateplugins/hsmenuworkerstateplugin/src/hsaddtohomescreenstate.cpp
changeset 63 52b0f64eeb51
parent 62 341166945d65
child 69 87476091b3f5
equal deleted inserted replaced
62:341166945d65 63:52b0f64eeb51
    15  *
    15  *
    16 */
    16 */
    17 
    17 
    18 #include <qstatemachine.h>
    18 #include <qstatemachine.h>
    19 #include <hblabel.h>
    19 #include <hblabel.h>
    20 #include <hsiwidgetprovider.h>
       
    21 #include <hsshortcutservice.h>
    20 #include <hsshortcutservice.h>
    22 #include <hscontentservice.h>
    21 #include <hscontentservice.h>
    23 #include <hbmessagebox.h>
    22 #include <hbmessagebox.h>
    24 #include <hbaction.h>
    23 #include <hbaction.h>
    25 #include <hbnotificationdialog.h>
    24 #include <hbnotificationdialog.h>
    26 #include <hsmenueventfactory.h>
    25 #include <hsmenueventfactory.h>
    27 
    26 #include "hsmenudialogfactory.h"
    28 #include "hsaddtohomescreenstate.h"
    27 #include "hsaddtohomescreenstate.h"
    29 #include "hsmenuevent.h"
    28 #include "hsmenuevent.h"
    30 #include "canotifier.h"
    29 #include "canotifier.h"
    31 #include "canotifierfilter.h"
    30 #include "canotifierfilter.h"
    32 #include "caservice.h"
    31 #include "caservice.h"
   161  */
   160  */
   162 void HsAddToHomeScreenState::showMessageWidgetCorrupted()
   161 void HsAddToHomeScreenState::showMessageWidgetCorrupted()
   163 {
   162 {
   164     HSMENUTEST_FUNC_ENTRY("HsCollectionState::showMessageWidgetCorrupted");
   163     HSMENUTEST_FUNC_ENTRY("HsCollectionState::showMessageWidgetCorrupted");
   165 
   164 
   166     mCorruptedMessage = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
   165     mCorruptedMessage = HsMenuDialogFactory().create(
   167     mCorruptedMessage->setAttribute(Qt::WA_DeleteOnClose);
   166             hbTrId("txt_applib_dialog_file_corrupted_unable_to_use_wi"));
   168 
   167     mConfirmAction = mCorruptedMessage->actions().value(0);
   169     QString message(hbTrId("txt_applib_dialog_file_corrupted_unable_to_use_wi"));
       
   170     mCorruptedMessage->setText(message);
       
   171 
       
   172     mCorruptedMessage->clearActions();
       
   173     mConfirmAction = new HbAction(hbTrId("txt_common_button_ok"), 
       
   174                                   mCorruptedMessage);
       
   175     mCorruptedMessage->addAction(mConfirmAction);
       
   176 
       
   177     HbAction *secondaryAction = new HbAction(
       
   178             hbTrId("txt_common_button_cancel"), mCorruptedMessage);
       
   179     mCorruptedMessage->addAction(secondaryAction);
       
   180 
       
   181     mCorruptedMessage->open(this, SLOT(messageWidgetCorruptedFinished(HbAction*)));
   168     mCorruptedMessage->open(this, SLOT(messageWidgetCorruptedFinished(HbAction*)));
   182 
   169 
   183     HSMENUTEST_FUNC_EXIT("HsCollectionState::showMessageWidgetCorrupted");
   170     HSMENUTEST_FUNC_EXIT("HsCollectionState::showMessageWidgetCorrupted");
   184 }
   171 }
   185 
   172 
   188  \retval void
   175  \retval void
   189  */
   176  */
   190 void HsAddToHomeScreenState::messageWidgetCorruptedFinished
   177 void HsAddToHomeScreenState::messageWidgetCorruptedFinished
   191         (HbAction* finishedAction)
   178         (HbAction* finishedAction)
   192 {
   179 {
   193     if (finishedAction == mConfirmAction) {
   180     if (static_cast<QAction*>(finishedAction) == mConfirmAction) {
   194         HsMenuService::executeAction(mEntryId, removeActionIdentifier());
   181         HsMenuService::executeAction(mEntryId, removeActionIdentifier());
   195     }
   182     }
   196     emit exit();
   183     emit exit();
   197     if (mMenuMode == AddHsMenuMode) {
   184     if (mMenuMode == AddHsMenuMode) {
   198         machine()->postEvent(
   185         machine()->postEvent(
   199             HsMenuEventFactory::createOpenHomeScreenEvent());
   186             HsMenuEventFactory::createOpenHomeScreenEvent());
   200     }
   187     }
       
   188     mConfirmAction = NULL;
   201 }
   189 }
   202 
   190 
   203 
   191 
   204 /*!
   192 /*!
   205  Slot launched after state has exited and in destructor.
   193  Slot launched after state has exited and in destructor.