86
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Menu delete collection item state
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <HbMessageBox>
|
|
19 |
#include "hsuinstallfailedstate.h"
|
|
20 |
#include "hsmenuevent.h"
|
|
21 |
#include "hsapp_defs.h"
|
90
|
22 |
#include "hsdialogcontroller.h"
|
86
|
23 |
|
|
24 |
const int installerBusyError = 4;
|
|
25 |
|
|
26 |
/*!
|
|
27 |
Constructor.
|
|
28 |
/param parent Parent state.
|
|
29 |
*/
|
|
30 |
HsUninstallFailedState::HsUninstallFailedState(QState *parent) :
|
90
|
31 |
QState(parent)
|
86
|
32 |
{
|
|
33 |
construct();
|
|
34 |
}
|
|
35 |
|
|
36 |
/*!
|
|
37 |
Destructor
|
|
38 |
*/
|
|
39 |
HsUninstallFailedState::~HsUninstallFailedState()
|
|
40 |
{
|
90
|
41 |
QT_TRY {
|
|
42 |
emit exit();
|
|
43 |
} QT_CATCH (...) {
|
|
44 |
}
|
86
|
45 |
}
|
|
46 |
|
|
47 |
/*!
|
|
48 |
Construction
|
|
49 |
*/
|
|
50 |
void HsUninstallFailedState::construct()
|
|
51 |
{
|
|
52 |
setObjectName("/HsUninstallFailedState");
|
|
53 |
if (this->parent()) {
|
|
54 |
setObjectName(this->parent()->objectName() + objectName());
|
|
55 |
}
|
|
56 |
}
|
|
57 |
|
|
58 |
|
|
59 |
/*!
|
|
60 |
Sets entry event.
|
|
61 |
\param event entry event.
|
|
62 |
*/
|
|
63 |
void HsUninstallFailedState::onEntry(QEvent *event)
|
90
|
64 |
{
|
86
|
65 |
QState::onEntry(event);
|
|
66 |
HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event);
|
|
67 |
QVariantMap data = menuEvent->data();
|
|
68 |
int error = data.value(Hs::uninstallError).toInt();
|
90
|
69 |
QScopedPointer<HbMessageBox> dialog;
|
86
|
70 |
if (error == installerBusyError) {
|
|
71 |
// Installer is in use
|
90
|
72 |
dialog.reset(new HbMessageBox(HbMessageBox::MessageTypeInformation));
|
|
73 |
dialog->setText(hbTrId("txt_applib_info_installer_is_currently_busy"));
|
86
|
74 |
} else {
|
|
75 |
// other errors
|
90
|
76 |
dialog.reset(new HbMessageBox(HbMessageBox::MessageTypeWarning));
|
|
77 |
dialog->setText(hbTrId("txt_applib_info_uninstallation_failed"));
|
86
|
78 |
}
|
|
79 |
|
90
|
80 |
|
|
81 |
dialog->setStandardButtons(HbMessageBox::Close);
|
|
82 |
|
|
83 |
QScopedPointer<HsDialogController> dialogController(
|
|
84 |
new HsDialogController(dialog.take(),
|
|
85 |
HsMenuDialogFactory::acceptActionIndex(),
|
|
86 |
HsMenuDialogFactory::rejectActionIndex()));
|
|
87 |
|
|
88 |
connect(dialogController.data(),
|
|
89 |
SIGNAL(dialogCompleted()),
|
|
90 |
this,
|
|
91 |
SIGNAL(exit()));
|
|
92 |
|
|
93 |
// ensure dialog is dismissed on app key pressed
|
|
94 |
connect(this, SIGNAL(exited()),
|
|
95 |
dialogController.data(),
|
|
96 |
SLOT(dismissDialog()));
|
|
97 |
|
|
98 |
dialogController.take()->openDialog();
|
86
|
99 |
}
|
|
100 |
|
|
101 |
|
|
102 |
|