62
|
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: Base for menu view states.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <hbmessagebox.h>
|
|
19 |
#include <HbParameterLengthLimiter>
|
|
20 |
#include <hbaction.h>
|
|
21 |
#include <canotifier.h>
|
|
22 |
|
|
23 |
#include "hsbaseviewstate.h"
|
|
24 |
|
|
25 |
/*!
|
|
26 |
Constructor.
|
|
27 |
*/
|
|
28 |
HsBaseViewState::HsBaseViewState(
|
|
29 |
QState *parent):
|
|
30 |
QState(parent),
|
|
31 |
mNotifier(0),
|
|
32 |
mMessageRelatedItemId(0),
|
|
33 |
mApplicationLaunchFailMessage(0)
|
|
34 |
{
|
|
35 |
construct();
|
|
36 |
}
|
|
37 |
|
|
38 |
/*!
|
|
39 |
Constructs contained objects.
|
|
40 |
*/
|
|
41 |
void HsBaseViewState::construct()
|
|
42 |
{
|
|
43 |
}
|
|
44 |
|
|
45 |
/*!
|
|
46 |
Creates and open application launch fail message.
|
|
47 |
\param errorCode eroor code to display.
|
|
48 |
*/
|
|
49 |
void HsBaseViewState::createApplicationLaunchFailMessage(int errorCode,int itemId)
|
|
50 |
{
|
|
51 |
QString message;
|
|
52 |
message.append(
|
|
53 |
HbParameterLengthLimiter("txt_applib_info_launching_the_application_failed").arg(
|
|
54 |
errorCode));
|
|
55 |
|
|
56 |
mMessageRelatedItemId = itemId;
|
|
57 |
|
|
58 |
// create and show message box
|
|
59 |
mApplicationLaunchFailMessage = new HbMessageBox(HbMessageBox::MessageTypeInformation);
|
|
60 |
mApplicationLaunchFailMessage->setAttribute(Qt::WA_DeleteOnClose);
|
|
61 |
|
|
62 |
mApplicationLaunchFailMessage->setText(message);
|
|
63 |
|
|
64 |
mApplicationLaunchFailMessage->clearActions();
|
|
65 |
HbAction *mClosemAction = new HbAction(hbTrId("txt_common_button_close"),
|
|
66 |
mApplicationLaunchFailMessage);
|
|
67 |
mApplicationLaunchFailMessage->addAction(mClosemAction);
|
|
68 |
|
|
69 |
mApplicationLaunchFailMessage->open(this, SLOT(applicationLaunchFailMessageFinished(HbAction*)));
|
|
70 |
|
|
71 |
subscribeForMemoryCardRemove();
|
|
72 |
}
|
|
73 |
|
|
74 |
/*!
|
|
75 |
Subscribe for memory card remove.
|
|
76 |
*/
|
|
77 |
void HsBaseViewState::subscribeForMemoryCardRemove()
|
|
78 |
{
|
|
79 |
if (mMessageRelatedItemId !=0 ) {
|
|
80 |
CaNotifierFilter filter;
|
|
81 |
filter.setIds(QList<int>() << mMessageRelatedItemId);
|
|
82 |
mNotifier = CaService::instance()->createNotifier(filter);
|
|
83 |
mNotifier->setParent(this);
|
|
84 |
connect(mNotifier,
|
|
85 |
SIGNAL(entryChanged(CaEntry,ChangeType)),
|
|
86 |
SLOT(cleanUpApplicationLaunchFailMessage()));
|
|
87 |
}
|
|
88 |
}
|
|
89 |
|
|
90 |
/*!
|
|
91 |
Clean up application launch fail message box.
|
|
92 |
\retval void
|
|
93 |
*/
|
|
94 |
void HsBaseViewState::cleanUpApplicationLaunchFailMessage()
|
|
95 |
{
|
|
96 |
if (mApplicationLaunchFailMessage) {
|
|
97 |
mApplicationLaunchFailMessage->close();
|
|
98 |
mApplicationLaunchFailMessage = NULL;
|
|
99 |
}
|
|
100 |
if (mNotifier) {
|
|
101 |
delete mNotifier;
|
|
102 |
mNotifier = NULL;
|
|
103 |
}
|
|
104 |
mMessageRelatedItemId = 0;
|
|
105 |
}
|
|
106 |
|
|
107 |
/*!
|
|
108 |
Action after closed application launch fail dialog.
|
|
109 |
\param finishedAction chosen action.
|
|
110 |
\retval void
|
|
111 |
*/
|
|
112 |
void HsBaseViewState::applicationLaunchFailMessageFinished(HbAction*)
|
|
113 |
{
|
|
114 |
mApplicationLaunchFailMessage = NULL;
|
|
115 |
cleanUpApplicationLaunchFailMessage();
|
|
116 |
}
|
|
117 |
|
|
118 |
/*!
|
|
119 |
Slot invoked when a state is exited.
|
|
120 |
*/
|
|
121 |
void HsBaseViewState::stateExited()
|
|
122 |
{
|
|
123 |
HSMENUTEST_FUNC_ENTRY("HsBaseViewState::stateExited");
|
|
124 |
cleanUpApplicationLaunchFailMessage();
|
|
125 |
HSMENUTEST_FUNC_EXIT("HsBaseViewState::stateExited");
|
|
126 |
}
|
|
127 |
|
|
128 |
/*!
|
|
129 |
Destructor.
|
|
130 |
*/
|
|
131 |
HsBaseViewState::~HsBaseViewState()
|
|
132 |
{
|
|
133 |
}
|