equal
deleted
inserted
replaced
29 #include "canotifierfilter.h" |
29 #include "canotifierfilter.h" |
30 |
30 |
31 #include "hsviewappdetailsstate.h" |
31 #include "hsviewappdetailsstate.h" |
32 #include "hsmenuevent.h" |
32 #include "hsmenuevent.h" |
33 #include "hsmenuitemmodel.h" |
33 #include "hsmenuitemmodel.h" |
34 #include "hsmenuentryremovedhandler.h" |
34 #include "hsdialogcontroller.h" |
35 |
35 |
36 static const char *const HS_VIEWAPPDETAILS_JAVA_DIALOG_SECTION_NAME= |
36 static const char *const HS_VIEWAPPDETAILS_JAVA_DIALOG_SECTION_NAME= |
37 "detailsDialogForJavaApplication"; |
37 "detailsDialogForJavaApplication"; |
38 |
38 |
39 /*! |
39 /*! |
40 Constructor. |
40 Constructor. |
41 /param parent Parent state. |
41 /param parent Parent state. |
42 */ |
42 */ |
43 HsViewAppDetailsState::HsViewAppDetailsState(QState *parent) : |
43 HsViewAppDetailsState::HsViewAppDetailsState(QState *parent) : |
44 QState(parent), mDialog(0) |
44 QState(parent) |
45 { |
45 { |
46 construct(); |
46 construct(); |
47 } |
47 } |
48 |
48 |
49 /*! |
49 /*! |
50 Destructor |
50 Destructor |
51 */ |
51 */ |
52 HsViewAppDetailsState::~HsViewAppDetailsState() |
52 HsViewAppDetailsState::~HsViewAppDetailsState() |
53 { |
53 { |
54 delete mDialog; |
54 QT_TRY { |
|
55 emit exit(); |
|
56 } QT_CATCH (...) { |
|
57 } |
55 } |
58 } |
56 |
59 |
57 /*! |
60 /*! |
58 Construction |
61 Construction |
59 */ |
62 */ |
80 |
83 |
81 const int entryId = data.value(Hs::itemIdKey).toInt(); |
84 const int entryId = data.value(Hs::itemIdKey).toInt(); |
82 QSharedPointer<const CaEntry> entry |
85 QSharedPointer<const CaEntry> entry |
83 = CaService::instance()->getEntry(entryId); |
86 = CaService::instance()->getEntry(entryId); |
84 if (!entry) { |
87 if (!entry) { |
85 stateExited(); |
88 emit exit(); |
86 return; |
89 return; |
87 } |
90 } |
88 const int componentId = entry->attribute( |
91 const int componentId = entry->attribute( |
89 Hs::componentIdAttributeName).toInt(); |
92 Hs::componentIdAttributeName).toInt(); |
90 |
93 |
94 QString appType = entry->attribute(Hs::swTypeKey); |
97 QString appType = entry->attribute(Hs::swTypeKey); |
95 |
98 |
96 |
99 |
97 //TODO: Should we display something In that case? |
100 //TODO: Should we display something In that case? |
98 if (detailMap.size() < 1){ |
101 if (detailMap.size() < 1){ |
99 stateExited(); |
102 emit exit(); |
100 return; |
103 return; |
101 } |
104 } |
102 |
105 |
103 HbDocumentLoader loader; |
106 HbDocumentLoader loader; |
104 bool loadStatusOk = false; |
107 bool loadStatusOk = false; |
110 QString section = QString(HS_VIEWAPPDETAILS_JAVA_DIALOG_SECTION_NAME); |
113 QString section = QString(HS_VIEWAPPDETAILS_JAVA_DIALOG_SECTION_NAME); |
111 loader.load(HS_DETAILS_DIALOG_LAYOUT, |
114 loader.load(HS_DETAILS_DIALOG_LAYOUT, |
112 section, &loadStatusOk); |
115 section, &loadStatusOk); |
113 } |
116 } |
114 |
117 |
115 mDialog = qobject_cast<HbDialog*>( |
118 QScopedPointer<HbDialog> dialog(qobject_cast<HbDialog*>( |
116 loader.findWidget(HS_DETAILS_DIALOG_NAME)); |
119 loader.findWidget(HS_DETAILS_DIALOG_NAME))); |
117 |
120 |
118 if (mDialog != NULL) { |
121 if (!dialog.isNull()) { |
119 mDialog->setTimeout(HbPopup::NoTimeout); |
122 dialog->setTimeout(HbPopup::NoTimeout); |
120 mDialog->setAttribute(Qt::WA_DeleteOnClose, true); |
123 dialog->actions()[0]->setParent(dialog.data()); |
121 mDialog->actions()[0]->setParent(mDialog); |
|
122 |
124 |
123 setFieldPresentation(CaSoftwareRegistry::componentNameKey(), |
125 setFieldPresentation(CaSoftwareRegistry::componentNameKey(), |
124 detailMap, loader); |
126 detailMap, loader); |
125 setFieldPresentation(CaSoftwareRegistry::componentVersionKey(), |
127 setFieldPresentation(CaSoftwareRegistry::componentVersionKey(), |
126 detailMap, loader); |
128 detailMap, loader); |
138 detailMap, loader); |
140 detailMap, loader); |
139 setFieldPresentation(CaSoftwareRegistry::componentProtectionDomainKey(), |
141 setFieldPresentation(CaSoftwareRegistry::componentProtectionDomainKey(), |
140 detailMap, loader); |
142 detailMap, loader); |
141 } |
143 } |
142 |
144 |
143 QScopedPointer<HsMenuEntryRemovedHandler> entryObserver( |
145 QScopedPointer<HsDialogController> dialogController( |
144 new HsMenuEntryRemovedHandler(entryId, this, SIGNAL(exit()))); |
146 new HsDialogController(dialog.take(), |
|
147 HsMenuDialogFactory::acceptActionIndex(), |
|
148 HsMenuDialogFactory::rejectActionIndex())); |
145 |
149 |
146 entryObserver.take()->setParent(mDialog); |
150 connect(dialogController.data(), |
|
151 SIGNAL(dialogCompleted()), |
|
152 this, |
|
153 SIGNAL(exit())); |
147 |
154 |
148 mDialog->open(this, SLOT(stateExited())); |
155 // ensure dialog is dismissed on app key pressed |
|
156 connect(this, SIGNAL(exited()), |
|
157 dialogController.data(), |
|
158 SLOT(dismissDialog())); |
|
159 |
|
160 dialogController.take()->openDialog(entryId); |
149 } else { |
161 } else { |
150 stateExited(); |
162 emit exit(); |
151 } |
163 } |
152 HSMENUTEST_FUNC_EXIT("HsViewAppDetailsState::onEntry"); |
164 HSMENUTEST_FUNC_EXIT("HsViewAppDetailsState::onEntry"); |
153 } |
165 } |
154 |
166 |
155 /*! |
167 /*! |
177 } else { |
189 } else { |
178 dataLabel->setPlainText(data); |
190 dataLabel->setPlainText(data); |
179 } |
191 } |
180 } |
192 } |
181 |
193 |
182 /*! |
|
183 Slot invoked when a state is exited. |
|
184 */ |
|
185 void HsViewAppDetailsState::stateExited() |
|
186 { |
|
187 HSMENUTEST_FUNC_ENTRY("HsViewAppDetailsState::stateExited"); |
|
188 emit exit(); |
|
189 HSMENUTEST_FUNC_EXIT("HsViewAppDetailsState::stateExited"); |
|
190 qDebug("HsViewAppDetailsState::stateExited()"); |
|
191 } |
|
192 |
194 |
193 /*! |
|
194 Invoked on exiting state |
|
195 */ |
|
196 void HsViewAppDetailsState::onExit(QEvent *event) |
|
197 { |
|
198 QState::onExit(event); |
|
199 // Close popups if App key was pressed or |
|
200 // memory card removed |
|
201 if (mDialog != NULL) { |
|
202 mDialog->close(); |
|
203 mDialog = NULL; |
|
204 } |
|
205 } |
|
206 |
195 |