appinstaller/AppinstUi/sifuidevicedialogplugin/src/sifuidialogtitlewidget.cpp
changeset 60 245df5276b97
parent 42 d17dc5398051
equal deleted inserted replaced
53:ae54820ef82c 60:245df5276b97
    21 #include <QGraphicsLinearLayout>
    21 #include <QGraphicsLinearLayout>
    22 #include <hblabel.h>
    22 #include <hblabel.h>
    23 #include <hbpushbutton.h>
    23 #include <hbpushbutton.h>
    24 #include <hbmessagebox.h>
    24 #include <hbmessagebox.h>
    25 
    25 
    26 const char KSifUiCertTrusted[]    = "qtg_small_secure";
    26 const char KSifUiCertTrusted[]    = "qtg_small_lock";
    27 const char KSifUiCertNotTrusted[] = "qtg_small_untrusted";
    27 const char KSifUiCertNotTrusted[] = "qtg_small_untrusted";
    28 
    28 
    29 
    29 
    30 // ======== MEMBER FUNCTIONS ========
    30 // ======== MEMBER FUNCTIONS ========
    31 
    31 
    73 
    73 
    74 // ----------------------------------------------------------------------------
    74 // ----------------------------------------------------------------------------
    75 // SifUiDialogTitleWidget::defaultTitle()
    75 // SifUiDialogTitleWidget::defaultTitle()
    76 // ----------------------------------------------------------------------------
    76 // ----------------------------------------------------------------------------
    77 //
    77 //
    78 QString SifUiDialogTitleWidget::defaultTitle(SifUiDeviceDialogType type)
    78 QString SifUiDialogTitleWidget::defaultTitle(SifUiDeviceDialogType type,
       
    79         SifUiInstallingPhase phase)
    79 {
    80 {
    80     QString title;
    81     QString title;
    81     switch (type) {
    82     switch (type) {
    82         case SifUiConfirmationQuery:
    83         case SifUiConfirmationQuery:
    83             //: Custom layout ID parent. Install confirmation query title.
    84             //: Custom layout ID parent. Install confirmation query title.
    84             //: Installation of an application starts if the user accepts the query.
    85             //: Installation of an application starts if the user accepts the query.
    85             title = hbTrId("txt_installer_title_install");
    86             title = hbTrId("txt_installer_title_install");
    86             break;
    87             break;
    87         case SifUiProgressNote:
    88         case SifUiProgressNote:
    88             //: Progress note title. Installation is going on and progress bar
    89             switch (phase) {
    89             //: shows how it proceeds.
    90                 case SifUiCheckingCerts:
    90             title = hbTrId("txt_installer_title_installing");
    91                     //: Progress note title. Installer validates certificates online.
       
    92                     //: This may take some time.
       
    93                     //TODO: localised UI string needed
       
    94                     title = hbTrId("Checking certificate validity");
       
    95                     break;
       
    96                 case SifUiInstalling:
       
    97                 case SifUiDownloading:
       
    98                 default:
       
    99                     //: Progress note title. Installation is going on and progress bar
       
   100                     //: shows how it proceeds.
       
   101                     title = hbTrId("txt_installer_title_installing");
       
   102                     break;
       
   103             }
    91             break;
   104             break;
    92         case SifUiCompleteNote:
   105         case SifUiCompleteNote:
    93             //: Installation complete note title. Indicates that installation
   106             //: Installation complete note title. Indicates that installation
    94             //: was succesfully completed. User has option to launch AppLib.
   107             //: was succesfully completed. User has option to launch AppLib.
    95             title = hbTrId("txt_installer_title_installed");
   108             title = hbTrId("txt_installer_title_installed");
   114     QString titleText;
   127     QString titleText;
   115     if (parameters.contains(KSifUiDialogTitle)) {
   128     if (parameters.contains(KSifUiDialogTitle)) {
   116         titleText = parameters.value(KSifUiDialogTitle).toString();
   129         titleText = parameters.value(KSifUiDialogTitle).toString();
   117     } else {
   130     } else {
   118         SifUiDeviceDialogType type = SifUiDialog::dialogType(parameters);
   131         SifUiDeviceDialogType type = SifUiDialog::dialogType(parameters);
   119         titleText = defaultTitle(type);
   132         SifUiInstallingPhase progressPhase = SifUiInstalling;
       
   133         if (parameters.contains(KSifUiProgressNotePhase)) {
       
   134             bool ok = false;
       
   135             int i = parameters.value(KSifUiProgressNotePhase).toInt(&ok);
       
   136             if (ok) {
       
   137                 progressPhase = static_cast<SifUiInstallingPhase>(i);
       
   138             }
       
   139         }
       
   140         titleText = defaultTitle(type, progressPhase);
   120     }
   141     }
   121     if (mTitle) {
   142     if (mTitle) {
   122         if (titleText != mTitle->plainText()) {
   143         if (titleText != mTitle->plainText()) {
   123             mTitle->setPlainText(titleText);
   144             mTitle->setPlainText(titleText);
   124         }
   145         }