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