|
1 /* |
|
2 * Copyright (c) 2000 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: Implementation of applicationmanagement components |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <hbdevicedialog.h> |
|
20 #include <apgtask.h> |
|
21 #include <eikenv.h> |
|
22 #include <driveinfo.h> |
|
23 #include <hbapplication.h> |
|
24 #include <hbmessagebox.h> |
|
25 #include "amstorage.h" |
|
26 #include "appmgmtnotifier.h" |
|
27 #include "appmgmtdownloadmgr.h" |
|
28 #include "ApplicationManagementUtility.h" |
|
29 #include "debug.h" |
|
30 |
|
31 // ------------------------------------------------------------------------------------------------ |
|
32 // AppMgmtNotifier::AppMgmtNotifier |
|
33 // ------------------------------------------------------------------------------------------------ |
|
34 AppMgmtNotifier::AppMgmtNotifier(QString aAppName) |
|
35 { |
|
36 m_appname = aAppName; |
|
37 } |
|
38 |
|
39 // ------------------------------------------------------------------------------------------------ |
|
40 // AppMgmtNotifier::~AppMgmtNotifier |
|
41 // ------------------------------------------------------------------------------------------------ |
|
42 AppMgmtNotifier::~AppMgmtNotifier() |
|
43 { |
|
44 } |
|
45 |
|
46 // ------------------------------------------------------------------------------------------------ |
|
47 // AppMgmtNotifier::getAvailableDrives |
|
48 // ------------------------------------------------------------------------------------------------ |
|
49 void AppMgmtNotifier::getAvailableDrives() |
|
50 { |
|
51 RFs iFs; |
|
52 int err; |
|
53 qt_symbian_throwIfError(iFs.Connect()); |
|
54 TDriveList driveList; |
|
55 TInt driveCount = 0; |
|
56 TBuf<20> buf; |
|
57 int i = 0; |
|
58 QString val; |
|
59 QStringList list; |
|
60 TDriveInfo info; |
|
61 TVolumeInfo volumeInfo; |
|
62 qt_symbian_throwIfError(DriveInfo::GetUserVisibleDrives(iFs, driveList, |
|
63 driveCount)); |
|
64 TUint driveStatus = 0; |
|
65 for (TInt index(0); index < KMaxDrives; index++) |
|
66 { |
|
67 if (driveList[index]) |
|
68 { |
|
69 TRealFormat realFormat; |
|
70 qt_symbian_throwIfError(DriveInfo::GetDriveStatus(iFs, index, |
|
71 driveStatus)); |
|
72 TFileName path; |
|
73 TDriveUnit driveUnit(index); |
|
74 if (!(driveStatus & DriveInfo::EDriveRemote)) |
|
75 { |
|
76 TBuf<64> freeSpace; |
|
77 TReal free; |
|
78 TInt64 freeKBytes; |
|
79 realFormat.iWidth = 6; |
|
80 iFs.Drive(info, index); |
|
81 if(iFs.Volume(volumeInfo, index)==KErrNone) |
|
82 { |
|
83 freeKBytes = 0; |
|
84 freeKBytes = volumeInfo.iFree / 1024; |
|
85 RDEBUG_2("free space: (%d)", volumeInfo.iFree ); |
|
86 free = volumeInfo.iFree / 1024; |
|
87 freeSpace.Num(freeKBytes); |
|
88 TInt sizeUnit = -1; |
|
89 |
|
90 //converting the drive freespace |
|
91 int len = freeSpace.Length(); |
|
92 if (len >= 7) |
|
93 { |
|
94 TReal nul = (1024 * 1024); |
|
95 TReal temp = free / nul; |
|
96 freeSpace.Num(temp, realFormat); |
|
97 sizeUnit = 1; |
|
98 } |
|
99 else |
|
100 { |
|
101 TReal temp = free / 1024; |
|
102 freeSpace.Num(temp, realFormat); |
|
103 sizeUnit = 0; |
|
104 } |
|
105 //Getting the drive name in QString |
|
106 path.Zero(); |
|
107 path.Append(driveUnit.Name()); |
|
108 val = QString::fromUtf16(path.Ptr(), path.Length()); |
|
109 m_Drilist.Append(path); |
|
110 //Getting the drive free space in QString |
|
111 path.Zero(); |
|
112 path.Append(freeSpace); |
|
113 QString str1 = QString::fromUtf16(path.Ptr(), path.Length()); |
|
114 QString driv; |
|
115 if (sizeUnit == -1) |
|
116 { |
|
117 driv |
|
118 = hbTrId( |
|
119 "txt_deviceupdate_setlabel_install_to_val_1_2_kb").arg( |
|
120 val, str1); |
|
121 } |
|
122 else if (sizeUnit == 0) |
|
123 { |
|
124 driv |
|
125 = hbTrId( |
|
126 "txt_deviceupdate_setlabel_install_to_val_1_2_Mb").arg( |
|
127 val, str1); |
|
128 } |
|
129 else |
|
130 { |
|
131 driv |
|
132 = hbTrId( |
|
133 "txt_deviceupdate_setlabel_install_to_val_1_2_Gb").arg( |
|
134 val, str1); |
|
135 } |
|
136 m_DriveBox->insertItem(i++, driv); |
|
137 } |
|
138 } |
|
139 } |
|
140 } |
|
141 } |
|
142 |
|
143 // ------------------------------------------------------------------------------------------------ |
|
144 // AppMgmtNotifier::showInstallDialog |
|
145 // ------------------------------------------------------------------------------------------------ |
|
146 void AppMgmtNotifier::showInstallDialog(CDeploymentComponent *aCompo, TRequestStatus &s) |
|
147 { |
|
148 bringServerToForeground(); |
|
149 iStat = &s; |
|
150 iComp = aCompo; |
|
151 HbDocumentLoader loader; |
|
152 QString val; |
|
153 bool ok = false; |
|
154 HbLabel* label; |
|
155 int err; |
|
156 iComp->SetDriveSelectionStatus(true); |
|
157 CDeliveryComponentStorage* iStorage ; |
|
158 QT_TRAP_THROWING(iStorage= CDeliveryComponentStorage::NewL()); |
|
159 TRAP( err, QT_TRYCATCH_LEAVING(iStorage->UpdateL(*iComp))); |
|
160 delete iStorage; |
|
161 loader.load(":/xml/sample.docml", &ok); |
|
162 if (!ok) |
|
163 { |
|
164 return; |
|
165 } |
|
166 Q_ASSERT_X(ok, "Device Manager", "Invalid docml file"); |
|
167 m_Dialog = qobject_cast<HbDialog*> (loader.findWidget("dialog")); |
|
168 |
|
169 //set title for the dialog |
|
170 label = qobject_cast<HbLabel*> (loader.findWidget( |
|
171 "qtl_dialog_pri_heading")); |
|
172 |
|
173 val = hbTrId("txt_device_update_title_install"); |
|
174 label->setPlainText(val); |
|
175 |
|
176 TDeploymentComponentName name = aCompo->ComponentName(); |
|
177 TBuf<KDeploymentComponentNameMaxLength> nameBuf; |
|
178 nameBuf.Copy(name); |
|
179 m_appname = QString::fromUtf16(nameBuf.Ptr(), nameBuf.Length()); |
|
180 //set the app name |
|
181 label = qobject_cast<HbLabel*> (loader.findWidget("label")); |
|
182 val = hbTrId("txt_deviceupdate_info_file_1_2").arg(m_appname); |
|
183 label->setPlainText(val); |
|
184 |
|
185 //size |
|
186 label = qobject_cast<HbLabel*> (loader.findWidget("label_1")); |
|
187 label->setPlainText(""); |
|
188 //icon |
|
189 label = qobject_cast<HbLabel*> (loader.findWidget("icon")); |
|
190 label->setIcon(HbIcon(":/icon/qgn_prop_sml_http.svg")); |
|
191 |
|
192 //"install to" label |
|
193 label = qobject_cast<HbLabel*> (loader.findWidget("qtl_dialog_pri5")); |
|
194 val = hbTrId("txt_device_update_setlabel_install_to"); |
|
195 label->setPlainText(val); |
|
196 |
|
197 //getting the available free space in all drives and adding to combobox |
|
198 |
|
199 m_DriveBox = qobject_cast<HbComboBox*> (loader.findWidget("combobox")); |
|
200 |
|
201 TRAP(err,getAvailableDrives()); |
|
202 if(err==KErrNone) |
|
203 { |
|
204 connect(m_DriveBox, SIGNAL(currentIndexChanged(int)), this, |
|
205 SLOT(defaultDriveChanged(int ))); |
|
206 } |
|
207 else |
|
208 m_DriveBox->setVisible(false); |
|
209 //setting the actions |
|
210 m_OkButton = qobject_cast<HbAction*> (loader.findObject( |
|
211 "qtl_dialog_softkey_2_left")); |
|
212 m_Cancel = qobject_cast<HbAction*> (loader.findObject( |
|
213 "qtl_dialog_softkey_2_right")); |
|
214 val = hbTrId("txt_common_button_ok"); |
|
215 m_OkButton->setText(val); |
|
216 val = hbTrId("txt_common_button_cancel"); |
|
217 m_Cancel->setText(val); |
|
218 m_Dialog->setTimeout(20000); |
|
219 CApplicationManagementUtility::mCurrDlg = m_Dialog; |
|
220 m_Dialog->open(this, SLOT(dlgSlot(HbAction*))); |
|
221 } |
|
222 |
|
223 // ------------------------------------------------------------------------------------------------ |
|
224 // AppMgmtNotifier::defaultDriveChanged |
|
225 // ------------------------------------------------------------------------------------------------ |
|
226 void AppMgmtNotifier::defaultDriveChanged(int i) |
|
227 { |
|
228 TAMInstallOptions opts = iComp->InstallOpts(); |
|
229 TChar drive = m_Drilist[i*2]; |
|
230 drive.LowerCase(); |
|
231 int err; |
|
232 opts.iOptions.iDrive = drive; |
|
233 TPtrC8 buf; |
|
234 TAMInstallOptionsPckg optsb(opts); |
|
235 buf.Set(optsb); |
|
236 TRAP( err, QT_TRYCATCH_LEAVING(iComp->SetInstallOptsL(buf))); |
|
237 CDeliveryComponentStorage* iStorage; |
|
238 TRAP( err, QT_TRYCATCH_LEAVING(iStorage = CDeliveryComponentStorage::NewL())); |
|
239 TRAP( err, QT_TRYCATCH_LEAVING(iStorage->UpdateL(*iComp))); |
|
240 delete iStorage; |
|
241 iStorage = NULL; |
|
242 } |
|
243 |
|
244 // ------------------------------------------------------------------------------------------------ |
|
245 // AppMgmtNotifier::dlgSlot |
|
246 // ------------------------------------------------------------------------------------------------ |
|
247 void AppMgmtNotifier::dlgSlot(HbAction* action) |
|
248 { |
|
249 if(action == m_Cancel) |
|
250 { |
|
251 sendServerToBackground(); |
|
252 TRequestStatus* status(iStat); |
|
253 User::RequestComplete(status, KStatusUserCancelled); |
|
254 } |
|
255 else |
|
256 { |
|
257 TRequestStatus* status(iStat); |
|
258 User::RequestComplete(status, KErrCompletion ); |
|
259 } |
|
260 CApplicationManagementUtility::mCurrDlg = 0; |
|
261 m_OkButton=0; |
|
262 m_Cancel = 0; |
|
263 } |
|
264 |
|
265 // ------------------------------------------------------------------------------------------------ |
|
266 // AppMgmtNotifier::showInstallFailedNote |
|
267 //launching a device dialog to display notefor "install failed" case |
|
268 // ------------------------------------------------------------------------------------------------ |
|
269 void AppMgmtNotifier::showInstallFailedNote() |
|
270 { |
|
271 HbDeviceDialog deviceDialog; |
|
272 QVariantMap parameters; |
|
273 //_LIT(KScomoNotifier, "scomonotifier"); |
|
274 parameters.insertMulti(QString("scomonotifier"), QVariant(QString("installfailed"))); |
|
275 QString data = m_appname; |
|
276 parameters.insertMulti(QString("scomoappname"), QVariant(data)); |
|
277 const char *deviceDialogType = "com.nokia.hb.devicemanagementdialog/1.0"; |
|
278 bool ret = deviceDialog.show(QString(deviceDialogType), parameters); |
|
279 } |
|
280 |
|
281 // ------------------------------------------------------------------------------------------------ |
|
282 // AppMgmtNotifier::sendServerToBackground |
|
283 // ------------------------------------------------------------------------------------------------ |
|
284 void AppMgmtNotifier::sendServerToBackground() |
|
285 { |
|
286 CCoeEnv* coe = CCoeEnv::Static(); |
|
287 TApaTaskList taskList(coe->WsSession()); |
|
288 TApaTask task=taskList.FindApp(TUid::Uid(KAppMgmtServerUid)); |
|
289 if(task.Exists()) |
|
290 { |
|
291 task.SendToBackground(); |
|
292 } |
|
293 } |
|
294 |
|
295 // ------------------------------------------------------------------------------------------------ |
|
296 // AppMgmtNotifier::bringServerToForeground |
|
297 // ------------------------------------------------------------------------------------------------ |
|
298 void AppMgmtNotifier::bringServerToForeground() |
|
299 { |
|
300 CCoeEnv* coe = CCoeEnv::Static(); |
|
301 TApaTaskList taskList(coe->WsSession()); |
|
302 TApaTask task = taskList.FindApp(TUid::Uid(KAppMgmtServerUid)); |
|
303 if (task.Exists()) |
|
304 { |
|
305 task.BringToForeground(); |
|
306 } |
|
307 } |
|
308 |
|
309 // ------------------------------------------------------------------------------------------------ |
|
310 // AppMgmtNotifier::operationSuccessSlot |
|
311 // ------------------------------------------------------------------------------------------------ |
|
312 void AppMgmtNotifier::successSlot(HbAction* action) |
|
313 { |
|
314 RDEBUG("successslot"); |
|
315 if(action == m_OkButton || action == NULL) |
|
316 { |
|
317 sendServerToBackground(); |
|
318 RDEBUG("slot entered"); |
|
319 TRequestStatus* status(iStat); |
|
320 User::RequestComplete(status, KErrCompletion); |
|
321 } |
|
322 m_OkButton = 0; |
|
323 RDEBUG("successslot end"); |
|
324 } |
|
325 |
|
326 // ------------------------------------------------------------------------------------------------ |
|
327 // AppMgmtNotifier::showInstallSuccessNote |
|
328 // ------------------------------------------------------------------------------------------------ |
|
329 void AppMgmtNotifier::showInstallSuccessNote() |
|
330 { |
|
331 if (CApplicationManagementUtility::mHidden == 1) |
|
332 { |
|
333 //Display Installation complete dialog |
|
334 HbDeviceNotificationDialog notificationDialog; |
|
335 QString text = |
|
336 hbTrId("txt_device_update_title_installation_complete"); |
|
337 notificationDialog.setTitle(text); |
|
338 text |
|
339 = hbTrId("txt_device_update_dblist_product_code_val_installa").arg( |
|
340 m_appname); |
|
341 notificationDialog.setText(text); |
|
342 notificationDialog.show(); |
|
343 } |
|
344 else |
|
345 { |
|
346 bringServerToForeground(); |
|
347 HbDocumentLoader loader; |
|
348 bool ok = false; |
|
349 loader.load(":/xml/error_notes.docml", &ok); |
|
350 QString val; |
|
351 // Exit if the file format is invalid |
|
352 Q_ASSERT_X(ok, "Device Manager", "Invalid docml file"); |
|
353 m_Dialog = qobject_cast<HbDialog*> (loader.findWidget( |
|
354 "dialog")); |
|
355 HbLabel* label = qobject_cast<HbLabel*> (loader.findWidget( |
|
356 "heading_text")); |
|
357 val = hbTrId("txt_device_update_title_installation_complete"); |
|
358 label->setPlainText(val); |
|
359 |
|
360 val = hbTrId("txt_deviceupdate_info_file_1_2").arg(m_appname); |
|
361 label = qobject_cast<HbLabel*> (loader.findWidget("content_text")); |
|
362 label->setPlainText(val); |
|
363 m_OkButton = qobject_cast<HbAction*> (loader.findObject( |
|
364 "qtl_dialog_softkey_2_left")); |
|
365 val = hbTrId("txt_common_button_ok"); |
|
366 m_OkButton->setText(val); |
|
367 |
|
368 m_Dialog->setTimeout(HbPopup::ContextMenuTimeout); |
|
369 //m_Dialog->setAttribute(Qt::WA_DeleteOnClose); |
|
370 m_Dialog->open(this, SLOT(successSlot(HbAction*))); |
|
371 CDialogWait* wait = CDialogWait::NewL(); |
|
372 registerStatus(wait->iStatus); |
|
373 RDEBUG_2("AppMgmtNotifier::Start before StartWait (%d)", wait->iStatus.Int()); |
|
374 wait->StartWait(); |
|
375 delete wait; |
|
376 } |
|
377 } |
|
378 |
|
379 // ------------------------------------------------------------------------------------------------ |
|
380 // AppMgmtNotifier::dialogUnSlot |
|
381 // ------------------------------------------------------------------------------------------------ |
|
382 void AppMgmtNotifier::dialogUnSlot(HbAction* retAction) |
|
383 { |
|
384 sendServerToBackground(); |
|
385 if (retAction == m_Cancel) |
|
386 { |
|
387 TRequestStatus* status(iStat); |
|
388 User::RequestComplete(status, KStatusUserCancelled); |
|
389 } |
|
390 else |
|
391 { |
|
392 TRequestStatus* status(iStat); |
|
393 User::RequestComplete(status, KErrCompletion); |
|
394 } |
|
395 CApplicationManagementUtility::mCurrDlg = 0; |
|
396 m_OkButton = 0; |
|
397 m_Cancel = 0; |
|
398 } |
|
399 |
|
400 |
|
401 // ------------------------------------------------------------------------------------------------ |
|
402 // AppMgmtNotifier::showUninstallDialog |
|
403 //uninstall beginning confirmation note |
|
404 // ------------------------------------------------------------------------------------------------ |
|
405 void AppMgmtNotifier::showUninstallDialog(const CDeploymentComponent &aCompo, |
|
406 TRequestStatus &s) |
|
407 { |
|
408 iStat = &s; |
|
409 bringServerToForeground(); |
|
410 |
|
411 HbDocumentLoader loader; |
|
412 bool ok; |
|
413 loader.load(":/xml/downloaddialog.docml", &ok); |
|
414 |
|
415 Q_ASSERT_X(ok, "Device Manager", "Invalid docml file"); |
|
416 m_Dialog = qobject_cast<HbDialog*> (loader.findWidget("dialog")); |
|
417 |
|
418 HbLabel* label = qobject_cast<HbLabel*> (loader.findWidget( |
|
419 "qtl_dialog_pri_heading")); |
|
420 QString val = hbTrId("txt_device_update_title_uninstalling_application"); |
|
421 label->setPlainText(val); |
|
422 |
|
423 label = qobject_cast<HbLabel*> (loader.findWidget("icon")); |
|
424 label->setIcon(HbIcon(":/icons/qgn_prop_sml_http.svg")); |
|
425 |
|
426 label = qobject_cast<HbLabel*> (loader.findWidget("qtl_dialog_pri5")); |
|
427 TDeploymentComponentName name = aCompo.ComponentName(); |
|
428 TBuf<255> ne; |
|
429 ne.Copy(name); |
|
430 |
|
431 QString str = QString::fromUtf16(ne.Ptr(), ne.Length()); |
|
432 val = hbTrId("txt_deviceupdate_info_application_1").arg(str); |
|
433 label->setPlainText(val); |
|
434 |
|
435 label = qobject_cast<HbLabel*> (loader.findWidget("qtl_dialog_pri5_1")); |
|
436 label->setPlainText(""); |
|
437 |
|
438 m_OkButton = qobject_cast<HbAction*> (loader.findObject( |
|
439 "qtl_dialog_softkey_2_left")); |
|
440 m_Cancel = qobject_cast<HbAction*> (loader.findObject( |
|
441 "qtl_dialog_softkey_2_right")); |
|
442 val = hbTrId("txt_common_button_ok"); |
|
443 m_OkButton->setText(val); |
|
444 val = hbTrId("txt_common_button_cancel"); |
|
445 m_Cancel->setText(val); |
|
446 CApplicationManagementUtility::mCurrDlg = m_Dialog; |
|
447 m_Dialog->setTimeout(10000); |
|
448 m_Dialog->open(this, SLOT(dialogUnSlot(HbAction*))); |
|
449 } |
|
450 |
|
451 |
|
452 // ------------------------------------------------------------------------------------------------ |
|
453 //AppMgmtNotifier::showUnInstallFailedNote |
|
454 //Displaying uninstall failed note |
|
455 // ------------------------------------------------------------------------------------------------ |
|
456 void AppMgmtNotifier::showUnInstallFailedNote() |
|
457 { |
|
458 HbDeviceDialog deviceDialog; |
|
459 QVariantMap parameters; |
|
460 //_LIT(KScomoNotifier, "scomonotifier"); |
|
461 parameters.insertMulti(QString("scomonotifier"), QVariant(QString( |
|
462 "uninstallfailed"))); |
|
463 QString data = m_appname; |
|
464 parameters.insertMulti(QString("scomoappname"), QVariant(data)); |
|
465 const char *deviceDialogType = "com.nokia.hb.devicemanagementdialog/1.0"; |
|
466 bool ret = deviceDialog.show(QString(deviceDialogType), parameters); |
|
467 } |
|
468 |
|
469 |
|
470 // ------------------------------------------------------------------------------------------------ |
|
471 // AppMgmtNotifier::showUnInstallSuccessNote |
|
472 //uninstall success notification |
|
473 // ------------------------------------------------------------------------------------------------ |
|
474 void AppMgmtNotifier::showUnInstallSuccessNote() |
|
475 { |
|
476 if (CApplicationManagementUtility::mHidden == 1) |
|
477 { |
|
478 //Display Installation complete dialog |
|
479 HbDeviceNotificationDialog notificationDialog; |
|
480 QString text = hbTrId( |
|
481 "txt_device_update_title_uninstallation_complete"); |
|
482 notificationDialog.setTitle(text); |
|
483 text |
|
484 = hbTrId( |
|
485 "txt_device_update_dblist_product_code_val_uninstalla_comple").arg( |
|
486 m_appname); |
|
487 notificationDialog.setText(text); |
|
488 notificationDialog.show(); |
|
489 } |
|
490 else |
|
491 { |
|
492 bringServerToForeground(); |
|
493 |
|
494 HbDocumentLoader loader; |
|
495 bool ok = false; |
|
496 loader.load(":/xml/error_notes.docml", &ok); |
|
497 QString val; |
|
498 // Exit if the file format is invalid |
|
499 Q_ASSERT_X(ok, "Device Manager", "Invalid docml file"); |
|
500 m_Dialog = qobject_cast<HbDialog*> (loader.findWidget( |
|
501 "dialog")); |
|
502 QString blank(""); |
|
503 HbLabel* label = qobject_cast<HbLabel*> (loader.findWidget( |
|
504 "heading_text")); |
|
505 val = hbTrId("txt_device_update_title_uninstallation_complete"); |
|
506 label->setPlainText(val); |
|
507 val |
|
508 = hbTrId( |
|
509 "txt_device_update_dblist_product_code_val_uninstalla_comple").arg( |
|
510 m_appname); |
|
511 label = qobject_cast<HbLabel*> (loader.findWidget("content_text")); |
|
512 label->setPlainText(val); |
|
513 m_OkButton = qobject_cast<HbAction*> (loader.findObject( |
|
514 "qtl_dialog_softkey_2_left")); |
|
515 val = hbTrId("txt_common_button_ok"); |
|
516 m_OkButton->setText(val); |
|
517 |
|
518 m_Dialog->setTimeout(HbPopup::StandardTimeout); |
|
519 m_Dialog->open(this, SLOT(successSlot(HbAction*))); |
|
520 CDialogWait* wait = CDialogWait::NewL(); |
|
521 registerStatus(wait->iStatus); |
|
522 RDEBUG_2("AppMgmtNotifier::Start before StartWait (%d)", wait->iStatus.Int()); |
|
523 wait->StartWait(); |
|
524 delete wait; |
|
525 } |
|
526 } |
|
527 |
|
528 // ------------------------------------------------------------------------------------------------ |
|
529 // AppMgmtNotifier::showDownloadFailedNote |
|
530 // ------------------------------------------------------------------------------------------------ |
|
531 bool AppMgmtNotifier::showDownloadFailedNote(QString aNotifierdata) |
|
532 { |
|
533 HbDeviceDialog deviceDialog; |
|
534 QVariantMap parameters; |
|
535 //_LIT(KScomoNotifier, "scomonotifier"); |
|
536 parameters.insertMulti(QString("scomonotifier"), QVariant(QString( |
|
537 "downloadfailed"))); |
|
538 parameters.insertMulti(QString("scomoappdata"),QVariant(aNotifierdata)); |
|
539 const char *deviceDialogType = "com.nokia.hb.devicemanagementdialog/1.0"; |
|
540 bool stat = deviceDialog.show(QString(deviceDialogType), parameters); |
|
541 return stat; |
|
542 } |
|
543 |
|
544 // ------------------------------------------------------------------------------------------------ |
|
545 // AppMgmtNotifier::showDownloadSuccessNote |
|
546 // ------------------------------------------------------------------------------------------------ |
|
547 void AppMgmtNotifier::showDownloadSuccessNote() |
|
548 { |
|
549 if (CApplicationManagementUtility::mHidden == 1) |
|
550 { |
|
551 HbDeviceNotificationDialog notificationDialog; |
|
552 QString tr = hbTrId("txt_device_update_title_download_complete"); |
|
553 notificationDialog.setTitle(tr); |
|
554 tr |
|
555 = hbTrId( |
|
556 "txt_device_update_dblist_product_code_val_download_comple").arg( |
|
557 m_appname); |
|
558 notificationDialog.setText(tr); |
|
559 notificationDialog.show(); |
|
560 } |
|
561 else |
|
562 { |
|
563 bringServerToForeground(); |
|
564 HbDocumentLoader loader; |
|
565 bool ok = false; |
|
566 loader.load(":/xml/error_notes.docml", &ok); |
|
567 QString val; |
|
568 // Exit if the file format is invalid |
|
569 Q_ASSERT_X(ok, "Device Manager", "Invalid docml file"); |
|
570 m_Dialog = qobject_cast<HbDialog*> (loader.findWidget( |
|
571 "dialog")); |
|
572 HbLabel* label = qobject_cast<HbLabel*> (loader.findWidget( |
|
573 "heading_text")); |
|
574 val = hbTrId("txt_device_update_title_download_complete"); |
|
575 label->setPlainText(val); |
|
576 |
|
577 val = hbTrId("txt_device_update_dblist_product_code_val_download_comple").arg(m_appname); |
|
578 label = qobject_cast<HbLabel*> (loader.findWidget("content_text")); |
|
579 label->setPlainText(val); |
|
580 m_OkButton = qobject_cast<HbAction*> (loader.findObject( |
|
581 "qtl_dialog_softkey_2_left")); |
|
582 val = hbTrId("txt_common_button_ok"); |
|
583 m_OkButton->setText(val); |
|
584 |
|
585 m_Dialog->setTimeout(HbPopup::ContextMenuTimeout); |
|
586 |
|
587 m_Dialog->open(this, SLOT(successSlot(HbAction*))); |
|
588 CDialogWait* wait = CDialogWait::NewL(); |
|
589 registerStatus(wait->iStatus); |
|
590 RDEBUG_2("AppMgmtNotifier::Start before StartWait (%d)", wait->iStatus.Int()); |
|
591 wait->StartWait(); |
|
592 delete wait; |
|
593 } |
|
594 } |
|
595 void AppMgmtNotifier::registerStatus(TRequestStatus &stat) |
|
596 { |
|
597 RDEBUG("registering request status"); |
|
598 iStat = &stat; |
|
599 stat = KRequestPending; |
|
600 RDEBUG_2("stat = %d",stat.Int() ); |
|
601 RDEBUG("registering request status end"); |
|
602 } |