vmbx/vmbxengine/src/vmbxqtuihandler.cpp
changeset 19 e44a8c097b15
parent 12 ae8abd0db65c
child 27 7eb70891911c
equal deleted inserted replaced
15:d7fc66ccd6fb 19:e44a8c097b15
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    15 *
    15 *
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 // qt
    19 // qt
    20 #include <QtGui/QtGui>
       
    21 #include <QString>
    20 #include <QString>
    22 #include <QObject>
    21 #include <QCoreApplication>
    23 
    22 #include <QRegExp>
    24 #include <hbdialog.h>
    23 
       
    24 #include <hbinputdialog.h>
    25 #include <hblabel.h>
    25 #include <hblabel.h>
    26 #include <hbaction.h>
    26 #include <hbaction.h>
    27 #include <hbtextedit.h>
       
    28 #include <hbmessagebox.h>
    27 #include <hbmessagebox.h>
    29 #include <hbvalidator.h>
       
    30 #include <hblineedit.h>
    28 #include <hblineedit.h>
    31 #include <hbinputeditorinterface.h>
    29 #include <hbinputeditorinterface.h>
       
    30 #include <hbinputstandardfilters.h>
       
    31 #include <hbinputfilter.h> 
    32 #include <hblistwidget.h>
    32 #include <hblistwidget.h>
       
    33 #include <dialogwaiter.h>
       
    34 
       
    35 #include <cvoicemailboxentry.h>
       
    36 #include <cvoicemailbox.h>
    33 
    37 
    34 #include "vmbxqtuihandler.h"
    38 #include "vmbxqtuihandler.h"
    35 #include "voicemailboxdefsinternal.h"
    39 #include "voicemailboxdefsinternal.h"
    36 #include "vmbxlogger.h"
    40 #include "vmbxlogger.h"
    37 
    41 
    40 // ----------------------------------------------------------------------------
    44 // ----------------------------------------------------------------------------
    41 // VmbxQtUiHandler::VmbxQtUiHandler
    45 // VmbxQtUiHandler::VmbxQtUiHandler
    42 // (Constructor).
    46 // (Constructor).
    43 // ----------------------------------------------------------------------------
    47 // ----------------------------------------------------------------------------
    44 //
    48 //
    45 VmbxQtUiHandler::VmbxQtUiHandler(QObject* parent): QObject(parent)
    49 VmbxQtUiHandler::VmbxQtUiHandler(QObject* parent): QObject(parent),
       
    50         iTranslator(0), iCommonTranslator(0), iQueryDialog(NULL)
    46 {
    51 {
    47     VMBLOGSTRING("VmbxQtUiHandler::VmbxQtUiHandler")
    52     VMBLOGSTRING("VmbxQtUiHandler::VmbxQtUiHandler")
       
    53     init();
    48     VMBLOGSTRING("VmbxQtUiHandler::VmbxQtUiHandler Exit")
    54     VMBLOGSTRING("VmbxQtUiHandler::VmbxQtUiHandler Exit")
    49 }
    55 }
    50 
    56 
    51 // ----------------------------------------------------------------------------
    57 // ----------------------------------------------------------------------------
    52 // VmbxQtUiHandler::~VmbxQtUiHandler
    58 // VmbxQtUiHandler::~VmbxQtUiHandler
    54 // ----------------------------------------------------------------------------
    60 // ----------------------------------------------------------------------------
    55 //
    61 //
    56 VmbxQtUiHandler::~VmbxQtUiHandler()
    62 VmbxQtUiHandler::~VmbxQtUiHandler()
    57 {
    63 {
    58     VMBLOGSTRING("VmbxQtUiHandler::~VmbxQtUiHandler")
    64     VMBLOGSTRING("VmbxQtUiHandler::~VmbxQtUiHandler")
       
    65     if ( iQueryDialog ) {
       
    66         delete iQueryDialog;
       
    67         iQueryDialog = NULL;
       
    68         VMBLOGSTRING("VmbxQtUiHandler::~VmbxQtUiHandler delete iQueryDialog")
       
    69     }
    59     VMBLOGSTRING("VmbxQtUiHandler::~VmbxQtUiHandler Exit")
    70     VMBLOGSTRING("VmbxQtUiHandler::~VmbxQtUiHandler Exit")
       
    71 }
       
    72 
       
    73 // ----------------------------------------------------------------------------
       
    74 // VmbxQtUiHandler::Init
       
    75 //
       
    76 // ----------------------------------------------------------------------------
       
    77 //
       
    78 void  VmbxQtUiHandler::init()
       
    79 {
       
    80     VMBLOGSTRING("VmbxQtUiHandler::init")
       
    81     QString lang = QLocale::system().name();
       
    82     VMBLOGSTRING2("VmbxQtUiHandler::init lang type %S",
       
    83             lang.utf16())
       
    84     QString path = "Z:/resource/qt/translations/";
       
    85     bool translatorLoaded = iTranslator.load("vmbx_"+lang, path);
       
    86     VMBLOGSTRING2("VmbxQtUiHandler::init load vmbx result %d",
       
    87             translatorLoaded)
       
    88     // Install vmbx localization
       
    89     if (translatorLoaded && qApp) {
       
    90         VMBLOGSTRING("VmbxQtUiHandler::init qApp !")
       
    91         qApp->installTranslator(&iTranslator);
       
    92     }
       
    93     // Install common localization, for select type "cancel".
       
    94     bool loaded = iCommonTranslator.load( "common_"+lang, path);
       
    95     VMBLOGSTRING2("VmbxQtUiHandler::init load common result %d",
       
    96         loaded)
       
    97     if (loaded && qApp) {
       
    98         VMBLOGSTRING("VmbxQtUiHandler::init qApp !!")
       
    99         qApp->installTranslator(&iCommonTranslator);
       
   100     }
       
   101     VMBLOGSTRING("VmbxQtUiHandler::init Exit")
    60 }
   102 }
    61 
   103 
    62 // ----------------------------------------------------------------------------
   104 // ----------------------------------------------------------------------------
    63 // VmbxQtUiHandler::ShowVmbxQueryDialog
   105 // VmbxQtUiHandler::ShowVmbxQueryDialog
    64 // (show query dialog).
   106 // (show query dialog).
    65 // ----------------------------------------------------------------------------
   107 // ----------------------------------------------------------------------------
    66 //
   108 //
    67 void VmbxQtUiHandler::showVmbxQueryDialog(const TVmbxType& aType,
   109 void VmbxQtUiHandler::showVmbxQueryDialog(const TVmbxType& aType,
    68                           const TVmbxQueryMode& aMode,
       
    69                           QString& aNumber, int& aResult)
   110                           QString& aNumber, int& aResult)
    70 {
   111 {
    71     VMBLOGSTRING("VmbxQtUiHandler::showVmbxQueryDialog")
   112     VMBLOGSTRING("VmbxQtUiHandler::showVmbxQueryDialog")
    72 
       
    73     HbDialog *displayPopup = new HbDialog();
       
    74     displayPopup->setDismissPolicy(HbDialog ::NoDismiss);
       
    75     displayPopup->setTimeout(HbDialog ::NoTimeout);
       
    76 
       
    77     displayPopup->setModal(true);
       
    78     QString header;
   113     QString header;
    79     if (EVmbxVoice == aType) {
   114     if (EVmbxVoice == aType) {
    80         if (EVmbxDefineMode == aMode) {
   115         header = hbTrId("txt_vmbx_title_voice_mailbox_number");
    81             header = tr("Define voice mailbox:");
   116     } else if (EVmbxVideo == aType) {
    82         } else {
       
    83             header = tr("Change voice mailbox:");
       
    84         }
       
    85     } else {
       
    86         // type of EVmbxVideo
   117         // type of EVmbxVideo
    87         if (EVmbxDefineMode == aMode) {
   118         header = hbTrId("txt_vmbx_title_video_mailbox_number");
    88             header = tr("Define video mailbox:");
   119     } else {
    89         } else {
   120         aResult = KErrCancel;
    90             header = tr("Change video mailbox:");
   121         VMBLOGSTRING( "VmbxQtUiHandler::showVmbxQueryDialog type error" )
    91         }
   122         return;
    92     }
   123     }
    93     // Set the label as heading widget
   124     iQueryDialog = new HbInputDialog();
    94     displayPopup->setHeadingWidget(new HbLabel(header));
   125     iQueryDialog->setDismissPolicy(HbDialog::NoDismiss);
    95     // Set the HbLineEdit as Content widget
   126     iQueryDialog->setTimeout(HbDialog::NoTimeout);
    96     // Define parameters for text box
   127 
    97     HbLineEdit *lineEdit = new HbLineEdit();
   128     iQueryDialog->setModal(true);
    98     lineEdit->setText( aNumber ); // default text
   129     // Set heading content
    99     //lineEdit->setMaximumRows( 3 ); // just a magic number
   130     iQueryDialog->setPromptText(header);
   100     HbEditorInterface inputMode(lineEdit); // Enables VKB
   131 
   101     inputMode.setInputMode( HbInputModeNumeric );
   132     // Set HbLineEdit  Content 
   102     // Limit charachter set
   133     iQueryDialog->lineEdit()->setText(aNumber); // default text
   103     HbValidator *val = new HbValidator;
   134     iQueryDialog->lineEdit()->setFocus(); // Enable the VKB
   104     QRegExp r;
   135     iQueryDialog->lineEdit()->setMaxLength(KVmbxPhoneCharMaxLength);
   105     r.setPattern("[0123456789*#+]{0,255}"); // define what characters can be entered
   136     HbEditorInterface inputMode(iQueryDialog->lineEdit());
   106     val->setMasterValidator(new QRegExpValidator(r,0));
   137     inputMode.setFilter(HbPhoneNumberFilter::instance());
   107     lineEdit->setValidator( val );
   138     bool ret = connect(iQueryDialog->lineEdit(), SIGNAL(textChanged(QString)),
   108 
   139         this, SLOT(updatePrimaryAction(QString)));    
   109     displayPopup->setContentWidget( lineEdit ); // ownership moved
   140     VMBLOGSTRING2( "VmbxQtUiHandler::showVmbxQueryDialog connect textChanged %d", ret)
   110 
   141     DialogWaiter waiter;
   111     HbAction* okAction = new HbAction(tr("Ok"));
   142     iQueryDialog->open(&waiter, SLOT(done(HbAction *)));
   112     // Sets the "OK"-action/button
   143     HbAction *result = waiter.wait();
   113     displayPopup->setPrimaryAction(okAction);
   144     if (result == iQueryDialog->primaryAction()) {
   114     bool ret = connect(okAction, SIGNAL(triggered()),
       
   115         displayPopup, SLOT(close()));
       
   116     VMBLOGSTRING2( "VmbxQtUiHandler::showVmbxQueryDialog:connect ok %d",
       
   117         ret )
       
   118     //  Sets the "Back"-action/button
       
   119     HbAction* cancelAction =  new HbAction(tr("Cancel"));
       
   120     displayPopup->setSecondaryAction(cancelAction);
       
   121     ret = connect(okAction, SIGNAL(triggered()),
       
   122         displayPopup, SLOT(close()));
       
   123     VMBLOGSTRING2( "VmbxQtUiHandler::showVmbxQueryDialog:connect cancel %d",
       
   124         ret )
       
   125     VMBLOGSTRING( "VmbxQtUiHandler::ShowVmbxQueryDialog to show" )
       
   126     HbAction* result = displayPopup->exec();
       
   127     if( okAction == result ) {
       
   128         VMBLOGSTRING( "VmbxQtUiHandler::showVmbxQueryDialog select OK" )
   145         VMBLOGSTRING( "VmbxQtUiHandler::showVmbxQueryDialog select OK" )
   129         // asign OK KEY value
   146         // asign OK KEY value
   130         aResult = KErrNone;
   147         aResult = KErrNone;
   131         aNumber = lineEdit->text();
   148         aNumber = iQueryDialog->lineEdit()->text();
   132         VMBLOGSTRING2( "VmbxQtUiHandler::showVmbxQueryDialog number = %s",
       
   133             aNumber.utf16() )
       
   134     } else {
   149     } else {
   135         aResult = KErrCancel;
   150         aResult = KErrCancel;
   136     }
   151     }
   137     delete val;
   152     delete iQueryDialog;
   138     val = 0;
   153     iQueryDialog = 0;
   139     delete displayPopup;
       
   140     displayPopup = 0;
       
   141     VMBLOGSTRING2("VmbxQtUiHandler::showVmbxQueryDialog aResult = %d", aResult)
   154     VMBLOGSTRING2("VmbxQtUiHandler::showVmbxQueryDialog aResult = %d", aResult)
   142     VMBLOGSTRING("VmbxQtUiHandler::showVmbxQueryDialog Exit")
   155     VMBLOGSTRING("VmbxQtUiHandler::showVmbxQueryDialog Exit")
   143 }
   156 }
   144 
   157 
   145 // ----------------------------------------------------------------------------
   158 // ----------------------------------------------------------------------------
   146 // VmbxQtUiHandler::showDefineSelectionDialog
   159 // VmbxQtUiHandler::showDefineSelectionDialog
   147 // (Shoe define list dialog).
   160 // (Shoe define list dialog).
   148 // ----------------------------------------------------------------------------
   161 // ----------------------------------------------------------------------------
   149 //
   162 //
   150 void VmbxQtUiHandler::showDefineSelectionDialog(
   163 void VmbxQtUiHandler::showDefineSelectionDialog(
   151     TVmbxType& aType, int& aResult)
   164     TVmbxType &aType, int &aResult)
   152 {
   165 {
   153     VMBLOGSTRING("VmbxQtUiHandler::showDefineSelectionDialog")
   166     VMBLOGSTRING("VmbxQtUiHandler::showDefineSelectionDialog")
   154     HbDialog* defineListDialog = new HbDialog();
   167     HbDialog* defineListDialog = new HbDialog();
   155     defineListDialog->setDismissPolicy(HbDialog::NoDismiss);
   168     defineListDialog->setDismissPolicy(HbDialog::NoDismiss);
   156     defineListDialog->setTimeout(HbDialog::NoTimeout);
   169     defineListDialog->setTimeout(HbDialog::NoTimeout);
   157 
   170 
   158     defineListDialog->setModal(true);
   171     defineListDialog->setModal(true);
   159     // Set heading widget
   172     // Set heading widget,"Define number:"
   160     defineListDialog->setHeadingWidget(new HbLabel(tr("Define number:")));
   173     defineListDialog->setHeadingWidget(new HbLabel(
       
   174             hbTrId("txt_vmbx_title_select_mailbox")));
   161     // Create a define list 
   175     // Create a define list 
   162     HbListWidget *list = new HbListWidget();
   176     HbListWidget *list = new HbListWidget();
   163     list->addItem(tr("Voice Mailbox"));
   177     //Voice Mailbox
   164     list->addItem(tr("Video Mailbox"));
   178     list->addItem(hbTrId("txt_vmbx_list_voice_mailbox"));
       
   179     //Video Mailbox
       
   180     list->addItem(hbTrId("txt_vmbx_list_video_mailbox"));
   165     // Set content widget
   181     // Set content widget
   166     defineListDialog->setContentWidget(list);
   182     defineListDialog->setContentWidget(list);
   167 
   183 
   168     HbAction* okAction = new HbAction(tr("Ok"));
   184     //  Sets the "Cancel"-action/button
   169     // Sets the "OK"-action/button
   185     HbAction *cancelAction =  new HbAction(hbTrId(
   170     defineListDialog->setPrimaryAction(okAction);
   186             "txt_common_button_cancel"));
   171     //  Sets the "Back"-action/button
       
   172     HbAction* cancelAction =  new HbAction(tr("Cancel"));
       
   173     defineListDialog->setSecondaryAction(cancelAction);
   187     defineListDialog->setSecondaryAction(cancelAction);
   174 
   188 
   175     connect(list, SIGNAL(activated(HbListWidgetItem*)), 
   189     connect(list, SIGNAL(activated(HbListWidgetItem *)), 
   176         defineListDialog, SLOT(close()));
   190         defineListDialog, SLOT(close()));
   177     HbAction* result = defineListDialog->exec();
   191     DialogWaiter waiter;
   178 
   192     defineListDialog->open(&waiter, SLOT(done(HbAction *)));
       
   193     HbAction *result = waiter.wait();
   179     if (cancelAction == result){
   194     if (cancelAction == result){
   180         aType = EVmbxNone;
   195         aType = EVmbxNone;
   181         aResult = KErrCancel;
   196         aResult = KErrCancel;
   182     } else {
   197     } else {
   183     // OK or single click items
   198         // Select one item
   184         aResult = KErrNone;
   199         aResult = KErrNone;
   185         int currentItem = list->row(list->currentItem());
   200         int currentItem = list->row(list->currentItem());
   186         VMBLOGSTRING2("VmbxQtUiHandler::showDefineSelectionDialog:\
   201         VMBLOGSTRING2("VmbxQtUiHandler::showDefineSelectionDialog:\
   187             currentItem %d", currentItem)
   202             currentItem %d", currentItem)
   188         if (0 == currentItem) {
   203         if (0 == currentItem) {
   196         aResult)
   211         aResult)
   197     delete defineListDialog;
   212     delete defineListDialog;
   198     defineListDialog = 0;
   213     defineListDialog = 0;
   199     VMBLOGSTRING("VmbxQtUiHandler::showDefineSelectionDialog Exit")
   214     VMBLOGSTRING("VmbxQtUiHandler::showDefineSelectionDialog Exit")
   200 }
   215 }
   201 // ----------------------------------------------------------------------------
   216 
   202 // VmbxQtUiHandler::ShowInformationNote
   217 // ----------------------------------------------------------------------------
       
   218 // VmbxQtUiHandler::showCallSelectionDialog
       
   219 // (show call selection dialog).
       
   220 // ----------------------------------------------------------------------------
       
   221 //
       
   222 void VmbxQtUiHandler::showCallSelectionDialog(
       
   223     const QList<CVoiceMailboxEntry *> entryList,
       
   224     TVoiceMailboxParams &params, int &result )
       
   225 {
       
   226     VMBLOGSTRING("VmbxQtUiHandler::showCallSelectionDialog")
       
   227     int count = entryList.count();
       
   228     VMBLOGSTRING("VmbxQtUiHandler::showCallSelectionDialog new before")
       
   229     HbDialog* callListDialog = new HbDialog();
       
   230     VMBLOGSTRING("VmbxQtUiHandler::showCallSelectionDialog new after")
       
   231     callListDialog->setDismissPolicy(HbDialog::NoDismiss);
       
   232     callListDialog->setTimeout(HbDialog::NoTimeout);
       
   233     callListDialog->setModal(true);
       
   234     // Set heading widget,"select mailbox"
       
   235     callListDialog->setHeadingWidget(new HbLabel(
       
   236                hbTrId("txt_vmbx_title_select_mailbox")));
       
   237     // Create a call list 
       
   238     HbListWidget *list = new HbListWidget();
       
   239     // Set content widget
       
   240     callListDialog->setContentWidget(list);
       
   241 
       
   242     QList<TVoiceMailboxParams> paramsList;
       
   243     TVoiceMailboxParams entryParams;
       
   244     for (int i = 0; i < count; i++) {
       
   245         TVmbxType vmbxType = entryList[i]->VoiceMailboxType();
       
   246         entryParams.iType = vmbxType;
       
   247         entryParams.iServiceId = entryList[i]->ServiceId();
       
   248         paramsList.append(entryParams);
       
   249         switch (vmbxType) {
       
   250             case EVmbxVoice:
       
   251                 {
       
   252                 list->addItem(hbTrId("txt_vmbx_list_voice_mailbox"));
       
   253                 break;
       
   254                 }
       
   255             case EVmbxVideo:
       
   256                 {
       
   257                 list->addItem(hbTrId("txt_vmbx_list_video_mailbox"));
       
   258                 break;
       
   259                 }
       
   260             case EVmbxVoip:
       
   261                 {
       
   262                 // Get name
       
   263                 TPtrC vmbxName( KNullDesC );
       
   264                 int voipRes = entryList[i]->GetVmbxName(vmbxName);
       
   265                 VMBLOGSTRING2( "VmbxQtUiHandler::showCallSelectionDialogL\
       
   266                     : voipRes=%I", voipRes );
       
   267                 if (KErrNone == voipRes) {
       
   268                     QString voipName;
       
   269                     if (vmbxName.Length() > 0) {
       
   270                         voipName=QString::fromUtf16(
       
   271                             vmbxName.Ptr(), vmbxName.Length());
       
   272                         // add voip item
       
   273                         list->addItem(voipName);
       
   274                     }
       
   275                 }
       
   276                 break;
       
   277                 }
       
   278             default:
       
   279                 break;
       
   280         }
       
   281     }
       
   282     //  Sets the "Cancel"-action/button
       
   283     HbAction *cancelAction = new HbAction(hbTrId(
       
   284         "txt_common_button_cancel_toolbar"));
       
   285     callListDialog->setSecondaryAction(cancelAction);
       
   286 
       
   287     connect(list, SIGNAL(activated(HbListWidgetItem *)), 
       
   288             callListDialog, SLOT(close()));
       
   289     DialogWaiter waiter;
       
   290     callListDialog->open(&waiter, SLOT(done(HbAction *)));
       
   291     HbAction *action = waiter.wait();
       
   292     if (cancelAction == action){
       
   293         params.iType = EVmbxNone;
       
   294         params.iServiceId = KVmbxServiceIdNone;
       
   295         result = KErrCancel;
       
   296     } else {
       
   297         // Select one item
       
   298         result = KErrNone;
       
   299         int currentItem = list->row(list->currentItem());
       
   300         VMBLOGSTRING2("VmbxQtUiHandler::showCallSelectionDialog:\
       
   301             currentItem %d", currentItem)
       
   302         params.iType = paramsList[currentItem].iType;
       
   303         params.iServiceId = paramsList[currentItem].iServiceId;
       
   304     }
       
   305     VMBLOGSTRING2("VmbxQtUiHandler::showCallSelectionDialog: params.iType %d",
       
   306         params.iType)
       
   307     VMBLOGSTRING2("VmbxQtUiHandler::showCallSelectionDialog: result%d",
       
   308         result)
       
   309     delete callListDialog;
       
   310     callListDialog = 0;
       
   311     VMBLOGSTRING("VmbxQtUiHandler::showCallSelectionDialog Exit")
       
   312 }
       
   313 
       
   314 // ----------------------------------------------------------------------------
       
   315 // VmbxQtUiHandler::showInformationNote
   203 // (show information note).
   316 // (show information note).
   204 // ----------------------------------------------------------------------------
   317 // ----------------------------------------------------------------------------
   205 //
   318 //
   206 void VmbxQtUiHandler::showInformationNote(int aNoteType)
   319 void VmbxQtUiHandler::showInformationNote(const TVmbxNoteType aType)
   207 {
   320 {
   208     VMBLOGSTRING("VmbxQtUiHandler::showInformationNote")
   321     VMBLOGSTRING("VmbxQtUiHandler::showInformationNote")
   209     QString noteText;
   322     QString noteText;
   210     QString iconName;
   323     VMBLOGSTRING2("VmbxQtUiHandler::showInformationNote type =%d", aType)
   211     VMBLOGSTRING2("VmbxQtUiHandler::~showInformationNote type =%d", aNoteType)
   324     switch (aType) {
   212     switch (aNoteType) {
       
   213     case EInvalidNumber:
   325     case EInvalidNumber:
   214         noteText = tr("Invalid phone number.");
   326         // Need to comfirm with ui designer
   215         iconName = "note_error";
   327         noteText = hbTrId("Invalid phone number.");
       
   328         break;
       
   329     case ENotAllowUserEditing:
       
   330         //User not allow to edit.
       
   331         noteText = hbTrId("Number not provisioned");
   216         break;
   332         break;
   217     case ESavedToPhoneMemory:
   333     case ESavedToPhoneMemory:
   218         noteText = tr("Voice mailbox number saved to Phone memory.");
   334     case ESavedToSimMemory:	
   219         iconName = "note_info";
   335         //Voice mailbox number saved to Phone memory.
   220         break;
   336         noteText = hbTrId("txt_vmbx_dpopinfo_voice_mailbox_number_saved");
   221     case ESavedToSimMemory:
       
   222         noteText = tr("Voice mailbox number saved to Sim card.");
       
   223         iconName = "note_info";
       
   224         break;
   337         break;
   225     case EVideoNumberSaved:
   338     case EVideoNumberSaved:
   226         noteText = tr("Video call mailbox saved.");
   339         //Video call mailbox saved.
   227         iconName = "note_info";
   340         noteText = hbTrId("txt_vmbx_dpopinfo_video_mailbox_number_saved");
       
   341         break;
       
   342     case EDefineVoiceNumber:
       
   343         //Define voice mailbox.
       
   344         noteText = hbTrId("txt_vmbx_dpopinfo_define_voice_mailbox_number");
       
   345         break;
       
   346     case EDefineVideoNumber:
       
   347         //Define video mailbox.
       
   348         noteText = hbTrId("txt_vmbx_dpopinfo_define_video_mailbox_number");
   228         break;
   349         break;
   229     default:
   350     default:
   230         VMBLOGSTRING("VmbxQtUiHandler::ShowInformationNote default")
   351         VMBLOGSTRING("VmbxQtUiHandler::ShowInformationNote default")
   231         break;
   352         break;
   232     }
   353     }
   233 
   354     HbMessageBox *msgBox = 0;
   234     HbMessageBox *msgBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
   355     if (EInvalidNumber == aType) {
       
   356         msgBox = new HbMessageBox(HbMessageBox::MessageTypeWarning);   
       
   357     } else {
       
   358         msgBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
       
   359     }
   235     msgBox->setText(noteText);
   360     msgBox->setText(noteText);
   236     msgBox->setIcon(HbIcon(iconName));
   361     msgBox->removeAction(msgBox->primaryAction());
   237     msgBox->exec();
   362     DialogWaiter waiter;
       
   363     msgBox->open(&waiter, SLOT(done(HbAction *)));
       
   364     waiter.wait();
   238     delete msgBox;
   365     delete msgBox;
   239     VMBLOGSTRING("VmbxQtUiHandler::~ShowInformationNote Exit")
   366     msgBox = 0;
   240     
   367     VMBLOGSTRING("VmbxQtUiHandler::showInformationNote Exit")
   241 }
   368 }
   242 
   369 
   243 // ----------------------------------------------------------------------------
   370 // ----------------------------------------------------------------------------
   244 // VmbxQtUiHandler::ShowSaveEmptyNote
   371 // VmbxQtUiHandler::updatePrimaryAction
   245 // (show information note).
   372 // (show information note).
   246 // ----------------------------------------------------------------------------
   373 // ----------------------------------------------------------------------------
   247 //
   374 //
   248 void VmbxQtUiHandler::showSaveEmptyNote(const TVmbxType& aType)
   375 void VmbxQtUiHandler::updatePrimaryAction(const QString &aInput)
   249 {
   376 {
   250     VMBLOGSTRING("VmbxQtUiHandler::~showSaveEmptyNote")
   377     HbAction *ok = iQueryDialog->primaryAction();
   251     QString noteText;
   378     if (aInput.isEmpty() || aInput.contains(QRegExp("\\d\\d\\d"))){
   252     VMBLOGSTRING2("VmbxQtUiHandler::~showSaveEmptyNote type = %d", aType)
   379         if (!ok->isEnabled()){
   253     switch (aType) {
   380             ok->setEnabled(true);
   254     case EVmbxVoice:
   381             VMBLOGSTRING("VmbxQtUiHandler::updatePrimaryAction enable OK")
   255         noteText = tr("Voice mailbox number not defined.");
   382         }
   256         break;
   383     }else{
   257     case EVmbxVideo:
   384         if (ok->isEnabled()){
   258         noteText = tr("Video mailbox number not defined.");
   385             ok->setEnabled(false);
   259         break;
   386             VMBLOGSTRING("VmbxQtUiHandler::updatePrimaryAction disable OK")  
   260     default:
   387         }
   261         VMBLOGSTRING("VmbxQtUiHandler::ShowSaveEmptyNote default")
   388     }  
   262         break;
       
   263     }
       
   264     HbMessageBox *msgBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
       
   265     msgBox->setText(noteText);
       
   266     msgBox->setIcon(HbIcon("note_error"));
       
   267     msgBox->exec();
       
   268     delete msgBox;
       
   269     VMBLOGSTRING("VmbxQtUiHandler::~ShowSaveEmptyNote Exit")
       
   270 }
   389 }
   271 
   390 
   272 //End of file
   391 //End of file