author | hgs |
Mon, 18 Oct 2010 10:20:15 +0300 | |
changeset 98 | e6f74eb7f69f |
parent 97 | 66b5fe3c07fd |
permissions | -rw-r--r-- |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: Menu All Applications state. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
63 | 18 |
#include <QStateMachine> |
19 |
#include <HbView> |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
20 |
#include <HbGroupBox> |
63 | 21 |
#include <HbListView> |
22 |
#include <HbAction> |
|
23 |
#include <HbMenu> |
|
24 |
#include <HbAbstractViewItem> |
|
25 |
||
26 |
#include <cadefs.h> |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include <caentry.h> |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
|
63 | 29 |
#include "hsapp_defs.h" |
30 |
#include "hsmenueventfactory.h" |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
#include "hsmenuitemmodel.h" |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
#include "hsinstalledappsstate.h" |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
#include "hsaddappstocollectionstate.h" |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
#include "hsmenumodetransition.h" |
90 | 35 |
#include "hsmenuevent.h" |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
/*! |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
\class HsInstalledAppsState |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
\ingroup group_hsapplibrarystateplugin |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
\brief Manages displaying installed applications |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
41 |
Displays all installed packages present on the device. |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
42 |
\see StateMachine |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
43 |
\lib ?library |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
44 |
*/ |
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
45 |
|
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
46 |
/*! |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
Constructor. |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
48 |
\param menuViewBuilder Menu view builder. |
63 | 49 |
\param mainWindow main window wrapper. |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
50 |
\param parent Owner. |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
*/ |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
52 |
HsInstalledAppsState::HsInstalledAppsState(HsMenuViewBuilder &menuViewBuilder, |
51
4785f57bf3d4
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
46
diff
changeset
|
53 |
HsMainWindow &mainWindow, |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
54 |
QState *parent): |
81 | 55 |
HsBaseViewState(mainWindow, parent), |
86 | 56 |
mSortAttribute(Hs::OldestOnTopHsSortAttribute), |
57 |
mLatestOnTopMenuAction(0), |
|
58 |
mOldestOnTopMenuAction(0) |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
{ |
63 | 60 |
initialize(menuViewBuilder, HsInstalledAppsContext); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
construct(); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
/*! |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
Constructor part. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
void HsInstalledAppsState::construct() |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
68 |
{ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
HSMENUTEST_FUNC_ENTRY("HsInstalledAppsState::construct"); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
70 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
71 |
const QString parentName = |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
72 |
parent() != 0 ? parent()->objectName() : QString(""); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
73 |
setObjectName(parentName + "/installedappsstate"); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
74 |
|
90 | 75 |
connect(mBackKeyAction, |
76 |
SIGNAL(triggered()), |
|
77 |
this, |
|
78 |
SLOT(backFromInstalledView())); |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::construct"); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
81 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
82 |
|
90 | 83 |
void HsInstalledAppsState::onEntry(QEvent *event) |
84 |
{ |
|
85 |
qDebug("HsInstalledAppsState::onEntry()"); |
|
86 |
HSMENUTEST_FUNC_ENTRY("HsInstalledAppsState::onEntry"); |
|
87 |
QState::onEntry(event); |
|
88 |
||
89 |
if (event->type() == HsMenuEvent::eventType()) { |
|
90 |
HsMenuEvent *menuEvent = static_cast<HsMenuEvent *>(event); |
|
91 |
QVariantMap data = menuEvent->data(); |
|
92 |
mCollectionId = data.value(Hs::itemIdKey).toInt(); |
|
93 |
mCollectionType = data.value(Hs::entryTypeNameKey).toString(); |
|
94 |
} |
|
95 |
||
96 |
HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::onEntry"); |
|
97 |
} |
|
98 |
||
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
99 |
/*! |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
100 |
Method seting menu options. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
101 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
102 |
void HsInstalledAppsState::setMenuOptions() |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
103 |
{ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
104 |
HSMENUTEST_FUNC_ENTRY("HsInstalledAppsState::setMenuOptions"); |
71 | 105 |
|
106 |
mViewOptions->clearActions(); |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
107 |
|
71 | 108 |
mViewOptions->addAction(hbTrId("txt_applib_opt_task_switcher"), |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
109 |
this, SLOT(openTaskSwitcher())); |
81 | 110 |
if (mModel->rowCount() > 0) { |
86 | 111 |
|
112 |
mLatestOnTopMenuAction = mViewOptions->addAction( |
|
113 |
hbTrId("txt_applib_menu_sort_by_latest_on_top"), |
|
114 |
this, SLOT(latestOnTopMenuAction())); |
|
115 |
mOldestOnTopMenuAction = mViewOptions->addAction( |
|
116 |
hbTrId("txt_applib_menu_sort_by_oldest_on_top"), |
|
117 |
this, SLOT(oldestOnTopMenuAction())); |
|
118 |
||
119 |
// as we geting already reversed list from query |
|
120 |
// we set it to OldestOnTopHsSortAttribute |
|
81 | 121 |
if(mSortAttribute == Hs::LatestOnTopHsSortAttribute) |
86 | 122 |
{ |
123 |
mOldestOnTopMenuAction->setVisible(false); |
|
124 |
} else { |
|
125 |
mLatestOnTopMenuAction->setVisible(false); |
|
81 | 126 |
} |
127 |
} |
|
90 | 128 |
mViewOptions->addAction(hbTrId("txt_applib_opt_installation_log"), |
129 |
this, SLOT(openInstallationLog())); |
|
71 | 130 |
mMenuView->view()->setMenu(mViewOptions); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
131 |
HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::setMenuOptions"); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
132 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
133 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
134 |
/*! |
63 | 135 |
Method seting context menu options. |
136 |
\param item the context menu is built for. |
|
137 |
\param flags of the \item. |
|
138 |
*/ |
|
97 | 139 |
void HsInstalledAppsState::setContextMenuOptions( |
140 |
HbAbstractViewItem *item, EntryFlags flags) |
|
63 | 141 |
{ |
97 | 142 |
Q_UNUSED(item) |
143 |
Q_UNUSED(flags) |
|
63 | 144 |
HbAction *uninstallAction = mContextMenu->addAction( |
97 | 145 |
hbTrId("txt_common_menu_delete")); |
81 | 146 |
uninstallAction->setData(Hs::UninstallContextAction); |
63 | 147 |
|
97 | 148 |
HbAction *appDetailsAction = mContextMenu->addAction( |
149 |
hbTrId("txt_common_menu_details")); |
|
150 |
appDetailsAction->setData(Hs::AppDetailsContextAction); |
|
63 | 151 |
} |
152 |
||
153 |
||
154 |
/*! |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
155 |
Destructor. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
156 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
157 |
HsInstalledAppsState::~HsInstalledAppsState() |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
158 |
{ |
63 | 159 |
mMenuView->inactivate(); |
160 |
mMenuView->view()->setNavigationAction(NULL); |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
161 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
162 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
163 |
/*! |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
164 |
Slot connected to entered() signal. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
165 |
Invoked when a state is entered. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
166 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
167 |
void HsInstalledAppsState::stateEntered() |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
168 |
{ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
169 |
qDebug("AllAppsState::stateEntered()"); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
170 |
HSMENUTEST_FUNC_ENTRY("HsInstalledAppsState::stateEntered"); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
171 |
|
63 | 172 |
if (!mModel) { |
173 |
mModel |
|
81 | 174 |
= HsMenuService::getInstalledModel(mSortAttribute); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
175 |
} |
97 | 176 |
|
177 |
updateLabel(); |
|
178 |
||
69 | 179 |
if (mModel->rowCount() == 0) { |
180 |
mMenuView->reset(HsEmptyLabelContext); |
|
181 |
} |
|
182 |
else { |
|
183 |
mMenuView->reset(HsItemViewContext); |
|
184 |
mMenuView->setModel(mModel); |
|
98 | 185 |
mMenuView->itemView()->scrollTo( |
69 | 186 |
mModel->index(0)); |
187 |
} |
|
97 | 188 |
|
69 | 189 |
setMenuOptions(); |
71 | 190 |
|
63 | 191 |
connect(mMenuView.data(), |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
192 |
SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), |
63 | 193 |
SLOT(showContextMenu(HbAbstractViewItem *, QPointF))); |
97 | 194 |
|
86 | 195 |
connect(mMenuView.data(), |
196 |
SIGNAL(activated(QModelIndex)), |
|
197 |
SLOT(launchDetails(QModelIndex))); |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
198 |
|
63 | 199 |
connect(mModel, SIGNAL(empty(bool)),this, |
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
200 |
SLOT(setEmptyLabelVisibility(bool))); |
97 | 201 |
|
202 |
connect(mModel, SIGNAL(countChange()),this, |
|
203 |
SLOT(updateLabel())); |
|
204 |
||
205 |
||
69 | 206 |
HsBaseViewState::stateEntered(); |
207 |
||
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
208 |
HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::stateEntered"); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
209 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
210 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
211 |
/*! |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
212 |
Slot invoked when a state is exited. |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
213 |
*/ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
214 |
void HsInstalledAppsState::stateExited() |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
215 |
{ |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
HSMENUTEST_FUNC_ENTRY("HsInstalledAppsState::stateExited"); |
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
217 |
|
97 | 218 |
disconnect(mModel, SIGNAL(countChange()),this, |
219 |
SLOT(updateLabel())); |
|
220 |
||
63 | 221 |
disconnect(mModel, SIGNAL(empty(bool)),this, |
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
222 |
SLOT(setEmptyLabelVisibility(bool))); |
97 | 223 |
|
86 | 224 |
disconnect(mMenuView.data(), |
225 |
SIGNAL(activated(QModelIndex)), this, |
|
226 |
SLOT(launchDetails(QModelIndex))); |
|
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
227 |
|
63 | 228 |
disconnect(mMenuView.data(), |
62 | 229 |
SIGNAL(longPressed(HbAbstractViewItem *, QPointF)), this, |
63 | 230 |
SLOT(showContextMenu(HbAbstractViewItem *, QPointF))); |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
231 |
|
62 | 232 |
HsBaseViewState::stateExited(); |
69 | 233 |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
234 |
HSMENUTEST_FUNC_EXIT("HsInstalledAppsState::stateExited"); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
235 |
qDebug("AllAppsState::stateExited()"); |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
236 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
237 |
|
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
238 |
/*! |
63 | 239 |
Handles button visibility. |
240 |
\param visibility indicates whether show or not to show 'empty' label. |
|
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
241 |
*/ |
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
242 |
void HsInstalledAppsState::setEmptyLabelVisibility(bool visibility) |
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
243 |
{ |
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
244 |
if(visibility){ |
69 | 245 |
mMenuView->reset(HsEmptyLabelContext); |
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
246 |
} else { |
69 | 247 |
mMenuView->reset(HsItemViewContext); |
248 |
mMenuView->setModel(mModel); |
|
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
249 |
} |
81 | 250 |
setMenuOptions(); |
69 | 251 |
mMenuView->activate(); |
55
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
252 |
} |
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
253 |
|
03646e8da489
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
51
diff
changeset
|
254 |
/*! |
97 | 255 |
Slot update label. |
256 |
*/ |
|
257 |
void HsInstalledAppsState::updateLabel() |
|
258 |
{ |
|
259 |
mMenuView->viewLabel()->setHeading( |
|
260 |
hbTrId("txt_applib_subtitle_installed").arg( |
|
261 |
mModel->rowCount())); |
|
262 |
} |
|
263 |
||
264 |
/*! |
|
90 | 265 |
Menu softkey back action slot |
266 |
*/ |
|
267 |
#ifdef COVERAGE_MEASUREMENT |
|
268 |
#pragma CTC SKIP |
|
269 |
#endif //COVERAGE_MEASUREMENT |
|
270 |
void HsInstalledAppsState::backFromInstalledView() |
|
271 |
{ |
|
272 |
machine()->postEvent( |
|
273 |
HsMenuEventFactory::createBackFromInstalledViewEvent( |
|
274 |
mCollectionId, mCollectionType)); |
|
275 |
} |
|
276 |
#ifdef COVERAGE_MEASUREMENT |
|
277 |
#pragma CTC ENDSKIP |
|
278 |
#endif //COVERAGE_MEASUREMENT |
|
279 |
||
280 |
/*! |
|
63 | 281 |
Open installation log. |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
282 |
*/ |
63 | 283 |
void HsInstalledAppsState::openInstallationLog() |
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
284 |
{ |
63 | 285 |
machine()->postEvent( |
286 |
HsMenuEventFactory::createInstallationLogEvent()); |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
287 |
} |
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
288 |
|
86 | 289 |
#ifdef COVERAGE_MEASUREMENT |
290 |
#pragma CTC SKIP |
|
291 |
#endif //COVERAGE_MEASUREMENT |
|
292 |
||
293 |
// calls tested factory method |
|
294 |
||
295 |
/*! |
|
296 |
Launches detail for app under index |
|
297 |
*/ |
|
298 |
void HsInstalledAppsState::launchDetails(const QModelIndex &index) |
|
299 |
{ |
|
97 | 300 |
QSharedPointer<const CaEntry> entry = mModel->entry(index); |
301 |
if (!entry.isNull() && !(entry->flags() & UninstallEntryFlag)) { |
|
302 |
||
303 |
machine()->postEvent(HsMenuEventFactory::createAppDetailsViewEvent( |
|
304 |
index.data(CaItemModel::IdRole).toInt())); |
|
305 |
} |
|
86 | 306 |
} |
307 |
||
308 |
#ifdef COVERAGE_MEASUREMENT |
|
309 |
#pragma CTC ENDSKIP |
|
310 |
#endif //COVERAGE_MEASUREMENT |
|
39
4e8ebe173323
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
311 |
/*! |
81 | 312 |
A Slot called when an action for sorting (latest |
313 |
on top) is invoked for Installed. |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
314 |
*/ |
81 | 315 |
void HsInstalledAppsState::latestOnTopMenuAction() |
69 | 316 |
{ |
81 | 317 |
// as we geting already reversed list from query |
318 |
// we set it to OldestOnTopHsSortAttribute |
|
319 |
mSortAttribute = Hs::OldestOnTopHsSortAttribute; |
|
320 |
mModel->setSort(mSortAttribute); |
|
86 | 321 |
mLatestOnTopMenuAction->setVisible(false); |
322 |
mOldestOnTopMenuAction->setVisible(true); |
|
81 | 323 |
} |
69 | 324 |
|
81 | 325 |
/*! |
326 |
A Slot called when an action for sorting (oldest |
|
327 |
on top) is invoked for Installed. |
|
328 |
*/ |
|
329 |
void HsInstalledAppsState::oldestOnTopMenuAction() |
|
330 |
{ |
|
331 |
// as we geting already reversed list from query |
|
332 |
// we set it to LatestOnTopHsSortAttribute |
|
333 |
mSortAttribute = Hs::LatestOnTopHsSortAttribute; |
|
334 |
mModel->setSort(mSortAttribute); |
|
86 | 335 |
mLatestOnTopMenuAction->setVisible(true); |
336 |
mOldestOnTopMenuAction->setVisible(false); |
|
46
23b5d6a29cce
Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
39
diff
changeset
|
337 |
} |