satui/satapp/src/satappuiprovider.cpp
changeset 19 e44a8c097b15
parent 15 d7fc66ccd6fb
child 23 427125ac6cb8
equal deleted inserted replaced
15:d7fc66ccd6fb 19:e44a8c097b15
    18 #include <QTime> // GetInkey duration return
    18 #include <QTime> // GetInkey duration return
    19 #include <QTimer> // timeout callback
    19 #include <QTimer> // timeout callback
    20 #include <hbmainwindow.h> // softkey
    20 #include <hbmainwindow.h> // softkey
    21 #include <hbdocumentloader.h> // application xml
    21 #include <hbdocumentloader.h> // application xml
    22 #include <hbaction.h> // action user response
    22 #include <hbaction.h> // action user response
    23 #include <hbvalidator.h>
       
    24 #include <hbmessagebox.h> // DisplayText, ConfirmSend,
    23 #include <hbmessagebox.h> // DisplayText, ConfirmSend,
    25 #include <hbdevicemessagebox.h> // CallControl, SetUpCall
    24 #include <hbdevicemessagebox.h> // CallControl, SetUpCall
    26 #include <hblabel.h> // DisplayText, GetInput, SetUpCall
    25 #include <hblabel.h> // DisplayText, GetInput, SetUpCall
    27 #include <hbinputdialog.h> // GetInkey
    26 #include <hbinputdialog.h> // GetInkey
    28 #include <hbprogressdialog.h> // SendSms wait note
    27 #include <hbprogressdialog.h> // SendSms wait note
    29 #include <hblineedit.h> // For GetInput
    28 #include <hblineedit.h> // For GetInput
    30 #include <hbinputeditorinterface.h> // GetInput
    29 #include <hbinputeditorinterface.h> // GetInput
       
    30 #include <hbinputeditorinterface.h>
       
    31 #include <hbinputstandardfilters.h>
       
    32 #include <hbinputfilter.h> 
       
    33 #include <dialogwaiter.h>
    31 #include "satappview.h" // SetUpMenu, SelectItem
    34 #include "satappview.h" // SetUpMenu, SelectItem
    32 #include "satappgetinkeynote.h" // GetYesNo immediate digit response
    35 #include "satappgetinkeynote.h" // GetYesNo immediate digit response
    33 #include "satappuiprovider.h"
    36 #include "satappuiprovider.h"
    34 #include "tflogger.h"
    37 #include "tflogger.h"
    35 
    38 
   274         mDisplayPopup->setHeadingWidget(heading);
   277         mDisplayPopup->setHeadingWidget(heading);
   275         mDisplayPopup->setText(aContent);
   278         mDisplayPopup->setText(aContent);
   276         composeDialog(mDisplayPopup, aDuration, ESatDialogDisplayText);
   279         composeDialog(mDisplayPopup, aDuration, ESatDialogDisplayText);
   277 
   280 
   278         TFLOGSTRING(
   281         TFLOGSTRING(
   279         "SATAPP: SatAppUiProvider::showDisplayTextPopup duration before exec")
   282         "SATAPP: SatAppUiProvider::showDisplayTextPopup duration before open")
   280         mDisplayPopup->exec();
   283         DialogWaiter waiter;
       
   284         mDisplayPopup->open(&waiter, SLOT(done(HbAction *)));
       
   285         waiter.wait();
   281         TFLOGSTRING(
   286         TFLOGSTRING(
   282         "SATAPP: SatAppUiProvider::showDisplayTextPopup duration end exec")
   287         "SATAPP: SatAppUiProvider::showDisplayTextPopup duration end open")
   283 
   288 
   284         delete mDisplayPopup;
   289         delete mDisplayPopup;
   285         mDisplayPopup = 0;
   290         mDisplayPopup = 0;
   286     }
   291     }
   287     TFLOGSTRING("SATAPP: SatAppUiProvider::showDisplayTextPopup exit")
   292     TFLOGSTRING("SATAPP: SatAppUiProvider::showDisplayTextPopup exit")
   309         // Set PromptText
   314         // Set PromptText
   310         mGetInkeyQuery->setPromptText(aHeading);
   315         mGetInkeyQuery->setPromptText(aHeading);
   311         // Set ContentText
   316         // Set ContentText
   312         QVariant vContent(aContent);
   317         QVariant vContent(aContent);
   313         mGetInkeyQuery->setValue(vContent);
   318         mGetInkeyQuery->setValue(vContent);
   314 
   319         HbEditorInterface inputMode(mGetInkeyQuery->lineEdit());
   315         // Validation rule, what can be entered
       
   316         HbValidator *val =new HbValidator;
       
   317 
       
   318         if (ESatDigitOnly == aCharacterSet) {
   320         if (ESatDigitOnly == aCharacterSet) {
   319             // digit mode, digits only (0 9, *, #, and +)
   321             // digit mode, digits only (0 9, *, #, and +)
   320             mGetInkeyQuery->setInputMode(HbInputDialog::IntInput);
   322 //            inputMode.setUpAsPhoneNumberEditor();
   321             // Define what digits can be entered
   323             inputMode.setFilter(HbPhoneNumberFilter::instance());
   322             QRegExp r("[0123456789*#+]{1,1}"); // from 1 to 1 digits
   324          } else {
   323             val->setMasterValidator(new QRegExpValidator(r,0));
       
   324             mGetInkeyQuery->setValidator(val);
       
   325         } else {
       
   326             // char mode
   325             // char mode
   327             mGetInkeyQuery->setInputMode(HbInputDialog::TextInput);
   326             inputMode.setUpAsLatinAlphabetOnlyEditor();
   328         }
   327         }
   329 
   328 
   330         unsigned int duration = KDefaultSelectionTimeoutMseconds;
   329         unsigned int duration = KDefaultSelectionTimeoutMseconds;
   331         if (aDuration) {
   330         if (aDuration) {
   332             duration = aDuration * KSymbianTimeConvertQtTime;
   331             duration = aDuration * KSymbianTimeConvertQtTime;
   334         composeDialog(mGetInkeyQuery, duration, ESatDialogGetInkey);
   333         composeDialog(mGetInkeyQuery, duration, ESatDialogGetInkey);
   335         mGetInkeyQuery->lineEdit()->setMaxLength(1);
   334         mGetInkeyQuery->lineEdit()->setMaxLength(1);
   336         connect(mGetInkeyQuery->lineEdit(), SIGNAL(textChanged(QString)),
   335         connect(mGetInkeyQuery->lineEdit(), SIGNAL(textChanged(QString)),
   337             this, SLOT(updateQueryAction(QString)));
   336             this, SLOT(updateQueryAction(QString)));
   338         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery before pop")
   337         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery before pop")
   339         mGetInkeyQuery->exec();
   338         DialogWaiter waiter;
       
   339         mGetInkeyQuery->open(&waiter, SLOT(done(HbAction *)));
       
   340         waiter.wait();
   340         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery end pop")
   341         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery end pop")
   341 
   342 
   342         QString inputString = (mGetInkeyQuery->value()).toString();
   343         QString inputString = (mGetInkeyQuery->value()).toString();
   343         aContent = inputString;
   344         aContent = inputString;
   344         delete val;
       
   345         delete mGetInkeyQuery;
   345         delete mGetInkeyQuery;
   346         mGetInkeyQuery = 0;
   346         mGetInkeyQuery = 0;
   347     }
   347     }
   348     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery exit")
   348     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery exit")
   349     return mUserRsp;
   349     return mUserRsp;
   392                 aDuration)
   392                 aDuration)
   393         QTime time;
   393         QTime time;
   394         time.start();
   394         time.start();
   395 
   395 
   396         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery befor pop")
   396         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery befor pop")
   397         mYesNoPopup->exec();
   397         DialogWaiter waiter;
       
   398         mYesNoPopup->open(&waiter, SLOT(done(HbAction *)));
       
   399         waiter.wait();
   398         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery end pop")
   400         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery end pop")
   399         aDuration = time.elapsed() / KSymbianTimeConvertQtTime;
   401         aDuration = time.elapsed() / KSymbianTimeConvertQtTime;
   400         TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery duration out=%d",
   402         TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery duration out=%d",
   401                 aDuration)
   403                 aDuration)
   402         delete mYesNoPopup;
   404         delete mYesNoPopup;
   433     // Set PromptText
   435     // Set PromptText
   434     mGetInputQuery->setPromptText(heading);
   436     mGetInputQuery->setPromptText(heading);
   435     // Set ContentText
   437     // Set ContentText
   436     QVariant vContent(content);
   438     QVariant vContent(content);
   437     mGetInputQuery->setValue(vContent);
   439     mGetInputQuery->setValue(vContent);
   438 
   440     HbEditorInterface inputMode(mGetInputQuery->lineEdit());
   439     // Validation rule, what can be entered
       
   440     HbValidator *val =new HbValidator;
       
   441     QRegExp r;
       
   442     if (ESatDigitOnly == characterSet) {
   441     if (ESatDigitOnly == characterSet) {
   443         // digit mode, digits only (0 9, *, #, and +)
   442         // digit mode, digits only (0 9, *, #, and +)
   444         mGetInputQuery->setInputMode(HbInputDialog::IntInput);
   443         inputMode.setFilter(HbPhoneNumberFilter::instance());
   445         // Define what digits can be entered
       
   446         r.setPattern("[0123456789*#+]{0,255}"); // define what characters can be entered
       
   447         val->setMasterValidator(new QRegExpValidator(r,0));
       
   448         mGetInputQuery->lineEdit()->setValidator(val);
       
   449     } else {
   444     } else {
   450         // char mode
   445         // char mode
   451         mGetInputQuery->setInputMode(HbInputDialog::TextInput);
   446         inputMode.setUpAsLatinAlphabetOnlyEditor();
   452     }
   447     }
   453 
       
   454     connect(mGetInputQuery->lineEdit(), SIGNAL(textChanged(QString)),
   448     connect(mGetInputQuery->lineEdit(), SIGNAL(textChanged(QString)),
   455         this, SLOT(updateQueryAction(QString)));
   449         this, SLOT(updateQueryAction(QString)));
   456     mGetInputQuery->lineEdit()->setMaxLength(maxLength);
   450     mGetInputQuery->lineEdit()->setMaxLength(maxLength);
   457 
   451 
   458     composeDialog(mGetInputQuery, KDefaultSelectionTimeoutMseconds, ESatDialogGetInput);
   452     composeDialog(mGetInputQuery, KDefaultSelectionTimeoutMseconds, ESatDialogGetInput);
   474         mGetInputQuery->lineEdit()->setEchoMode(HbLineEdit::Password);
   468         mGetInputQuery->lineEdit()->setEchoMode(HbLineEdit::Password);
   475         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery hide")
   469         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery hide")
   476     }
   470     }
   477 
   471 
   478     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery before pop")
   472     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery before pop")
   479     mGetInputQuery->exec();
   473     DialogWaiter waiter;
       
   474     mGetInputQuery->open(&waiter, SLOT(done(HbAction *)));
       
   475     waiter.wait();
   480     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery end pop")
   476     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery end pop")
   481 
   477 
   482     content = (mGetInputQuery->value()).toString();
   478     content = (mGetInputQuery->value()).toString();
   483 
   479 
   484     delete val;
       
   485     delete mGetInputQuery;
   480     delete mGetInputQuery;
   486     mGetInputQuery = 0;
   481     mGetInputQuery = 0;
   487 
   482 
   488     TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetInputQuery mUserRsp =%d exit",
   483     TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetInputQuery mUserRsp =%d exit",
   489             mUserRsp)
   484             mUserRsp)
   557     mConfirmSendQuery = new HbMessageBox();
   552     mConfirmSendQuery = new HbMessageBox();
   558     if(mConfirmSendQuery) {
   553     if(mConfirmSendQuery) {
   559         mConfirmSendQuery->setText(aText);
   554         mConfirmSendQuery->setText(aText);
   560         composeDialog(mConfirmSendQuery, 0, ESatDialogConfirmSend);
   555         composeDialog(mConfirmSendQuery, 0, ESatDialogConfirmSend);
   561 
   556 
   562         TFLOGSTRING("SATAPP: SatAppUiProvider::confirmSend before exec")
   557         TFLOGSTRING("SATAPP: SatAppUiProvider::confirmSend before open")
   563         mConfirmSendQuery->exec();
   558         DialogWaiter waiter;
   564         TFLOGSTRING("SATAPP: SatAppUiProvider::confirmSend after exec")
   559         mConfirmSendQuery->open(&waiter, SLOT(done(HbAction *)));
       
   560         waiter.wait();
       
   561         TFLOGSTRING("SATAPP: SatAppUiProvider::confirmSend after open")
   565 
   562 
   566         delete mConfirmSendQuery;
   563         delete mConfirmSendQuery;
   567         mConfirmSendQuery = 0;
   564         mConfirmSendQuery = 0;
   568     }
   565     }
   569     aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false;
   566     aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false;
   681     mSetUpCallQuery = new HbMessageBox(HbMessageBox::MessageTypeInformation);
   678     mSetUpCallQuery = new HbMessageBox(HbMessageBox::MessageTypeInformation);
   682     if(mSetUpCallQuery) {
   679     if(mSetUpCallQuery) {
   683         mSetUpCallQuery->setText(alphaId);
   680         mSetUpCallQuery->setText(alphaId);
   684         composeDialog(mSetUpCallQuery, 0, ESatDialogSetUpCall);
   681         composeDialog(mSetUpCallQuery, 0, ESatDialogSetUpCall);
   685 
   682 
   686         TFLOGSTRING("SATAPP: SatAppSetUpCall::showSetUpCallConfirm before exec")
   683         TFLOGSTRING("SATAPP: SatAppSetUpCall::showSetUpCallConfirm before open")
   687         mSetUpCallQuery->exec();
   684         DialogWaiter waiter;
   688         TFLOGSTRING("SATAPP: SatAppSetUpCall::showSetUpCallConfirm after exec")
   685         mSetUpCallQuery->open(&waiter, SLOT(done(HbAction *)));
       
   686         waiter.wait();
       
   687         TFLOGSTRING("SATAPP: SatAppSetUpCall::showSetUpCallConfirm after open")
   689 
   688 
   690         delete mSetUpCallQuery;
   689         delete mSetUpCallQuery;
   691         mSetUpCallQuery = 0;
   690         mSetUpCallQuery = 0;
   692     }
   691     }
   693     aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false;
   692     aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false;
  1019 void SatAppUiProvider::showSsErrorNote()
  1018 void SatAppUiProvider::showSsErrorNote()
  1020 {
  1019 {
  1021     TFLOGSTRING("SATAPP: SatAppUiProvider::showSsErrorNote")
  1020     TFLOGSTRING("SATAPP: SatAppUiProvider::showSsErrorNote")
  1022     HbMessageBox *msgBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
  1021     HbMessageBox *msgBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
  1023     msgBox->setText(hbTrId("txt_sat_sendss_error_note"));
  1022     msgBox->setText(hbTrId("txt_sat_sendss_error_note"));
  1024     msgBox->exec();
  1023     DialogWaiter waiter;
       
  1024     msgBox->open(&waiter, SLOT(done(HbAction *)));
       
  1025     waiter.wait();
  1025     delete msgBox;
  1026     delete msgBox;
  1026     msgBox = NULL;
  1027     msgBox = NULL;
  1027     TFLOGSTRING("SATAPP: SatAppUiProvider::showSsErrorNote exit")
  1028     TFLOGSTRING("SATAPP: SatAppUiProvider::showSsErrorNote exit")
  1028 }
  1029 }
  1029 
  1030 
  1045     if(mConfirmBipQuery) {
  1046     if(mConfirmBipQuery) {
  1046         // Sets the "Yes"-action/button
  1047         // Sets the "Yes"-action/button
  1047         mConfirmBipQuery->setText(title);
  1048         mConfirmBipQuery->setText(title);
  1048         composeDialog(mConfirmBipQuery, 0, ESatDialogConfirmBip);
  1049         composeDialog(mConfirmBipQuery, 0, ESatDialogConfirmBip);
  1049 
  1050 
  1050         TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery before exec")
  1051         TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery before open")
  1051         mConfirmBipQuery->exec();
  1052         DialogWaiter waiter;
  1052         TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery after exec")
  1053         mConfirmBipQuery->open(&waiter, SLOT(done(HbAction *)));
       
  1054         waiter.wait();
       
  1055         TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery after open")
  1053 
  1056 
  1054         delete mConfirmBipQuery;
  1057         delete mConfirmBipQuery;
  1055         mConfirmBipQuery = 0;
  1058         mConfirmBipQuery = 0;
  1056     }
  1059     }
  1057 
  1060 
  1115 {
  1118 {
  1116     TFLOGSTRING("SATAPP: SatAppUiProvider::showMoSmControlNote")
  1119     TFLOGSTRING("SATAPP: SatAppUiProvider::showMoSmControlNote")
  1117     HbMessageBox *msgBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
  1120     HbMessageBox *msgBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
  1118     msgBox->setText(aText);
  1121     msgBox->setText(aText);
  1119     msgBox->setTimeout(KMoSmControlTimeOut);
  1122     msgBox->setTimeout(KMoSmControlTimeOut);
  1120     msgBox->exec();
  1123     DialogWaiter waiter;
       
  1124     msgBox->open(&waiter, SLOT(done(HbAction *)));
       
  1125     waiter.wait();
  1121     delete msgBox;
  1126     delete msgBox;
  1122     TFLOGSTRING("SATAPP: SatAppUiProvider::showMoSmControlNote exit")
  1127     TFLOGSTRING("SATAPP: SatAppUiProvider::showMoSmControlNote exit")
  1123 
  1128 
  1124 }
  1129 }
  1125 
  1130 
  1149 void SatAppUiProvider::showSatInfoNote(const QString &aText)
  1154 void SatAppUiProvider::showSatInfoNote(const QString &aText)
  1150 {
  1155 {
  1151     TFLOGSTRING("SATAPP: SatAppUiProvider::showSatInfoNote")
  1156     TFLOGSTRING("SATAPP: SatAppUiProvider::showSatInfoNote")
  1152     HbMessageBox *msgBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
  1157     HbMessageBox *msgBox = new HbMessageBox(HbMessageBox::MessageTypeInformation);
  1153     msgBox->setText(aText);
  1158     msgBox->setText(aText);
  1154     msgBox->exec();
  1159     DialogWaiter waiter;
       
  1160     msgBox->open(&waiter, SLOT(done(HbAction *)));
       
  1161     waiter.wait();
  1155     delete msgBox;
  1162     delete msgBox;
  1156     msgBox = 0;
  1163     msgBox = 0;
  1157     TFLOGSTRING("SATAPP: SatAppUiProvider::showSatInfoNote exit")
  1164     TFLOGSTRING("SATAPP: SatAppUiProvider::showSatInfoNote exit")
  1158 }
  1165 }
  1159 
  1166