satui/satapp/src/satappuiprovider.cpp
changeset 31 a2467631ae02
parent 27 7eb70891911c
equal deleted inserted replaced
27:7eb70891911c 31:a2467631ae02
    30 #include <hbinputeditorinterface.h>
    30 #include <hbinputeditorinterface.h>
    31 #include <hbinputstandardfilters.h>
    31 #include <hbinputstandardfilters.h>
    32 #include <hbinputfilter.h> 
    32 #include <hbinputfilter.h> 
    33 #include <dialogwaiter.h>
    33 #include <dialogwaiter.h>
    34 #include "satappview.h" // SetUpMenu, SelectItem
    34 #include "satappview.h" // SetUpMenu, SelectItem
    35 #include "satappgetinkeynote.h" // GetYesNo immediate digit response
       
    36 #include "satappuiprovider.h"
    35 #include "satappuiprovider.h"
    37 #include "tflogger.h"
    36 #include "tflogger.h"
    38 
    37 
    39 const char *SATAPP_DOCML = ":/xml/satapp.docml";
    38 const char *SATAPP_DOCML = ":/xml/satapp.docml";
    40 const char *SATAPP_SETUPMENU_VIEW = "setupmenu_view";
    39 const char *SATAPP_SETUPMENU_VIEW = "setupmenu_view";
    41 const char *SATAPP_SELECTITEM_VIEW = "selectitem_view";
    40 const char *SATAPP_SELECTITEM_VIEW = "selectitem_view";
    42 
    41 
    43 // ======== MEMBER FUNCTIONS ==================================================
    42 // ======== MEMBER FUNCTIONS ==================================================
    44 // TODO: #ifndef _DEBUG need to be remove when orbit works well. Now the macro
    43 // TODO: #ifndef __WINS__ need to be remove when orbit works well. Now the macro
    45 // is to avoid panic on emulator. Deleting pointer before create dialog is to
    44 // is to avoid panic on emulator. Deleting pointer before create dialog is to
    46 // avoid memory leak in emulator.
    45 // avoid memory leak in emulator.
    47 
    46 
    48 // ----------------------------------------------------------------------------
    47 // ----------------------------------------------------------------------------
    49 // SatAppUiProvider
    48 // SatAppUiProvider
    53     HbMainWindow &window,
    52     HbMainWindow &window,
    54     SatAppEventProvider &event,
    53     SatAppEventProvider &event,
    55     QObject *parent) :
    54     QObject *parent) :
    56     QObject(parent), mMainWindow(window), mLoader(0),
    55     QObject(parent), mMainWindow(window), mLoader(0),
    57     mSetupMenuView(0), mSelectItemView(0), mDisplayPopup(0),
    56     mSetupMenuView(0), mSelectItemView(0), mDisplayPopup(0),
    58     mGetInkeyQuery(0), mYesNoPopup(0), mGetInputQuery(0),
    57     mGetInkeyQuery(0),mYesNoPopup(0), mImmediateQuery(0), mGetInputQuery(0),
    59     mConfirmSendQuery(0), mSetUpCallQuery(0), mCallControlMsg(0),
    58     mConfirmSendQuery(0), mSetUpCallQuery(0), mCallControlMsg(0),
    60     mConfirmBipQuery(0), mUserRsp(EUserNoResponse), mDigitalRsp(0), 
    59     mConfirmBipQuery(0), mUserRsp(EUserNoResponse), mDigitalRsp(0), 
    61     mMinLength(0), mTimer(0), mLoop(0),mWaitNote(0)
    60     mMinLength(0), mTimer(0), mLoop(0),mWaitNote(0)
    62 {
    61 {
    63     TFLOGSTRING("SATAPP: SatAppUiProvider::SatAppUiProvider call");
    62     TFLOGSTRING("SATAPP: SatAppUiProvider::SatAppUiProvider call");
   124     while (!mObjects.isEmpty()) {
   123     while (!mObjects.isEmpty()) {
   125         TFLOGSTRING(
   124         TFLOGSTRING(
   126         "SATAPP: SatAppUiProvider::~SatAppUiProvider object tree");
   125         "SATAPP: SatAppUiProvider::~SatAppUiProvider object tree");
   127         delete mObjects.takeFirst();
   126         delete mObjects.takeFirst();
   128     }
   127     }
       
   128     
   129     if (mDisplayPopup) {
   129     if (mDisplayPopup) {
   130         delete mDisplayPopup;
   130         delete mDisplayPopup;
   131         mDisplayPopup = 0;
   131         mDisplayPopup = 0;
   132     }
   132     }
       
   133     
   133     if (mGetInkeyQuery) {
   134     if (mGetInkeyQuery) {
   134         delete mGetInkeyQuery;
   135         delete mGetInkeyQuery;
   135         mGetInkeyQuery = 0;
   136         mGetInkeyQuery = 0;
   136     }
   137     }
       
   138 
   137     if (mYesNoPopup) {
   139     if (mYesNoPopup) {
   138         delete mYesNoPopup;
   140         delete mYesNoPopup;
   139         mYesNoPopup = 0;
   141         mYesNoPopup = 0;
       
   142     }
       
   143 
       
   144     if (mImmediateQuery) {
       
   145         delete mImmediateQuery;
       
   146         mImmediateQuery = 0;
   140     }
   147     }
   141     if (mGetInputQuery) {
   148     if (mGetInputQuery) {
   142         delete mGetInputQuery;
   149         delete mGetInputQuery;
   143         mGetInputQuery = 0;
   150         mGetInputQuery = 0;
   144     }
   151     }
   269     resetUserResponse();
   276     resetUserResponse();
   270     stopShowWaitNote();
   277     stopShowWaitNote();
   271     
   278     
   272     if (mDisplayPopup){
   279     if (mDisplayPopup){
   273         delete mDisplayPopup;
   280         delete mDisplayPopup;
   274         mDisplayPopup = NULL;        
   281         mDisplayPopup = NULL;
   275     }
   282     }
   276     mDisplayPopup = new HbMessageBox(HbMessageBox::MessageTypeInformation);
   283     mDisplayPopup = new HbMessageBox(HbMessageBox::MessageTypeInformation);
       
   284 
   277     if (mDisplayPopup) {
   285     if (mDisplayPopup) {
   278         TFLOGSTRING(
   286         TFLOGSTRING(
   279         "SATAPP: SatAppUiProvider::showDisplayTextPopup note created")
   287         "SATAPP: SatAppUiProvider::showDisplayTextPopup note created")
   280 
   288 
   281         // Set the label as heading widget
   289         // Set the label as heading widget
   289         DialogWaiter waiter;
   297         DialogWaiter waiter;
   290         mDisplayPopup->open(&waiter, SLOT(done(HbAction *)));
   298         mDisplayPopup->open(&waiter, SLOT(done(HbAction *)));
   291         waiter.wait();
   299         waiter.wait();
   292         TFLOGSTRING(
   300         TFLOGSTRING(
   293         "SATAPP: SatAppUiProvider::showDisplayTextPopup duration end open")
   301         "SATAPP: SatAppUiProvider::showDisplayTextPopup duration end open")
   294         
   302 #ifndef __WINS__
   295 #ifndef _DEBUG
       
   296         delete mDisplayPopup;
   303         delete mDisplayPopup;
   297         mDisplayPopup = 0;
   304         mDisplayPopup = 0;
   298 #endif        
   305 #endif
   299     }
   306     }
   300     TFLOGSTRING("SATAPP: SatAppUiProvider::showDisplayTextPopup exit")
   307     TFLOGSTRING("SATAPP: SatAppUiProvider::showDisplayTextPopup exit")
   301     return mUserRsp;
   308     return mUserRsp;
   302 }
   309 }
   303 
   310 
   316     resetUserResponse();
   323     resetUserResponse();
   317     stopShowWaitNote();
   324     stopShowWaitNote();
   318     
   325     
   319     if (mGetInkeyQuery){
   326     if (mGetInkeyQuery){
   320         delete mGetInkeyQuery;
   327         delete mGetInkeyQuery;
   321         mGetInkeyQuery = NULL;       
   328         mGetInkeyQuery = NULL;
   322     }
   329     }
   323     mGetInkeyQuery = new HbInputDialog();
   330     mGetInkeyQuery = new HbInputDialog();
   324     if (mGetInkeyQuery) {
   331     if (mGetInkeyQuery) {
   325         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery note created")
   332         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery note created")
   326         // Set PromptText
   333         // Set PromptText
   335             inputMode.setFilter(HbPhoneNumberFilter::instance());
   342             inputMode.setFilter(HbPhoneNumberFilter::instance());
   336          } else {
   343          } else {
   337             // char mode
   344             // char mode
   338             inputMode.setUpAsLatinAlphabetOnlyEditor();
   345             inputMode.setUpAsLatinAlphabetOnlyEditor();
   339         }
   346         }
   340 
   347         composeDialog(mGetInkeyQuery, aDuration, ESatDialogGetInkey);
   341         unsigned int duration = KDefaultSelectionTimeoutMseconds;
       
   342         if (aDuration) {
       
   343             duration = aDuration * KSymbianTimeConvertQtTime;
       
   344         }
       
   345         composeDialog(mGetInkeyQuery, duration, ESatDialogGetInkey);
       
   346         mGetInkeyQuery->lineEdit()->setMaxLength(1);
   348         mGetInkeyQuery->lineEdit()->setMaxLength(1);
   347         connect(mGetInkeyQuery->lineEdit(), SIGNAL(textChanged(QString)),
   349         connect(mGetInkeyQuery->lineEdit(), SIGNAL(textChanged(QString)),
   348             this, SLOT(updateQueryAction(QString)));
   350             this, SLOT(updateQueryAction(QString)));
   349         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery before pop")
   351         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery before pop")
   350         DialogWaiter waiter;
   352         DialogWaiter waiter;
   353         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery end pop")
   355         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery end pop")
   354 
   356 
   355         QString inputString = (mGetInkeyQuery->value()).toString();
   357         QString inputString = (mGetInkeyQuery->value()).toString();
   356         aContent = inputString;
   358         aContent = inputString;
   357         
   359         
   358 #ifndef _DEBUG       
   360 #ifndef __WINS__
   359         delete mGetInkeyQuery;
   361         delete mGetInkeyQuery;
   360         mGetInkeyQuery = 0;
   362         mGetInkeyQuery = 0;
   361 #endif        
   363 #endif
   362     }
   364     }
   363     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery exit")
   365     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInkeyQuery exit")
   364     return mUserRsp;
   366     return mUserRsp;
   365 }
   367 }
   366 
   368 
   369 // ----------------------------------------------------------------------------
   371 // ----------------------------------------------------------------------------
   370 //
   372 //
   371 int SatAppUiProvider::showGetYesNoQuery(
   373 int SatAppUiProvider::showGetYesNoQuery(
   372     const QString &aText,
   374     const QString &aText,
   373     const TSatCharacterSet aCharacterSet,
   375     const TSatCharacterSet aCharacterSet,
       
   376     unsigned int &aInkey,
   374     unsigned int &aDuration,
   377     unsigned int &aDuration,
   375     const bool aImmediateDigitResponse)
   378     const bool aImmediateDigitResponse)
   376 {
   379 {
   377     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery call")
   380     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery call")
   378     resetUserResponse();
   381     resetUserResponse();
   379     stopShowWaitNote();
   382     stopShowWaitNote();
   380     TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery duration in=%d",
   383     TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery duration in=%d",
   381             aDuration)
   384             aDuration)
   382     unsigned int duration = KDefaultSelectionTimeoutMseconds;
       
   383     if (aDuration) {
       
   384         duration = aDuration * KSymbianTimeConvertQtTime;
       
   385     }
       
   386     TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery duration=%d",
       
   387             duration)
       
   388     
       
   389     if (mYesNoPopup){
       
   390         delete mYesNoPopup;
       
   391         mYesNoPopup = NULL;        
       
   392     }
       
   393     
       
   394     if (ESatYesNo == aCharacterSet) {
   385     if (ESatYesNo == aCharacterSet) {
   395         mYesNoPopup = new SatAppGetInkeyNote(aText);
   386         if (mYesNoPopup){
   396         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery normal")
   387             delete mYesNoPopup;
   397         composeDialog(mYesNoPopup, duration, ESatDialogGetYesNo);
   388             mYesNoPopup = 0;
   398     } else if (aImmediateDigitResponse){
   389        }
   399         // user can choose the charactor or digital , and only cancel
   390         mYesNoPopup = new HbMessageBox(HbMessageBox::MessageTypeInformation);
   400         // key press, then close current dialog
   391 
   401         mYesNoPopup = new SatAppGetInkeyNote(aText);
   392         if (mYesNoPopup) {
   402         composeDialog(mYesNoPopup, duration, ESatDialogGetDigitalRsp);
   393             TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery normal")
   403 
   394             // Set the label as heading widget
   404         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery immediate")
   395             HbLabel *lHeading = new HbLabel(aText, mYesNoPopup);
   405         bool ret = connect(mYesNoPopup, SIGNAL(digitalKeyPressed(int)),
   396             mYesNoPopup->setHeadingWidget(lHeading);
   406                  this, SLOT(digitalResponse(int)),
   397             mYesNoPopup->setIconVisible(false);
   407                  Qt::DirectConnection);
   398 
   408         TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery:\
   399             composeDialog(mYesNoPopup, aDuration, ESatDialogGetYesNo);
   409         digitalKeyPressed=%d", ret)
   400 
   410     }
   401             TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery before open")
   411     if (mYesNoPopup) {
   402             DialogWaiter waiter;
   412         TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery duration=%d",
   403             mYesNoPopup->open(&waiter, SLOT(done(HbAction *)));
   413                 aDuration)
   404             waiter.wait();
   414         QTime time;
   405             TFLOGSTRING( "SATAPP: SatAppUiProvider::showGetYesNoQuery after open")
   415         time.start();
   406             mYesNoPopup->close();
   416 
   407         }
   417         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery befor pop")
   408     } else if (aImmediateDigitResponse) {
   418         DialogWaiter waiter;
   409         if (mImmediateQuery) {
   419         mYesNoPopup->open(&waiter, SLOT(done(HbAction *)));
   410             delete mImmediateQuery;
   420         waiter.wait();
   411             mImmediateQuery = 0;
   421         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery end pop")
   412         }
   422         aDuration = time.elapsed() / KSymbianTimeConvertQtTime;
   413         mImmediateQuery = new HbInputDialog();
   423         TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery duration out=%d",
   414         if (mImmediateQuery) {
   424                 aDuration)
   415             mImmediateQuery->setPromptText(aText);
   425 #ifndef _DEBUG        
   416             // user can choose the charactor or digital , and only cancel
   426         delete mYesNoPopup;
   417             // key press, then close current dialog
   427         mYesNoPopup = 0;
   418             TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery immediate")
   428 #endif        
   419             composeDialog(mImmediateQuery, aDuration, ESatDialogGetDigitalRsp);
   429     }
   420             bool ret = connect(mImmediateQuery->lineEdit(), 
   430     if (ESatYesNo == aCharacterSet) {
   421                SIGNAL(textChanged(QString)),
   431         mDigitalRsp = mUserRsp;
   422                this, SLOT(updateQueryAction(QString)));
   432         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery:yes/no rsp")
   423             TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery:\
   433     }
   424                connect updateQueryAction=%d", ret)
   434     return  mDigitalRsp;
   425             // digit mode, digits only (0 9, *, #, and +)
   435 }
   426             HbEditorInterface inputMode(mImmediateQuery->lineEdit());
   436 
   427             inputMode.setFilter(HbPhoneNumberFilter::instance());
       
   428             if (mLoop) {
       
   429                 TFLOGSTRING("SatAppUiProvider::showGetYesNoQuery delete loop")
       
   430                 delete mLoop;
       
   431                 mLoop = 0;
       
   432             }
       
   433             if (mTimer) {
       
   434                 delete mTimer;
       
   435                 mTimer = 0;
       
   436                 TFLOGSTRING("SatAppUiProvider::showGetYesNoQuery delete timer")
       
   437             }
       
   438             mTimer = new QTimer(this);
       
   439             mTimer->start(aDuration);
       
   440             ret = connect(mTimer, SIGNAL(timeout()), mTimer, SLOT(stop()));
       
   441             TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetYesNoQuery connect\
       
   442                 mTimer stop: %d", ret)
       
   443             mLoop = new QEventLoop(this);
       
   444             ret = connect(mTimer, SIGNAL(timeout()), mLoop, SLOT(quit()));
       
   445             TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery befor pop")
       
   446             mImmediateQuery->open();
       
   447             mLoop->exec();
       
   448             TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery end pop")
       
   449             if (mTimer->isActive()) {
       
   450                 TFLOGSTRING("SATAPP: SatAppUiProvider::showGetYesNoQuery stop time")
       
   451                 mTimer->stop();
       
   452             }
       
   453             aInkey = mDigitalRsp;
       
   454             mImmediateQuery->close();
       
   455         }
       
   456     }
       
   457     return  mUserRsp;
       
   458 }
   437 
   459 
   438 // ----------------------------------------------------------------------------
   460 // ----------------------------------------------------------------------------
   439 // showGetInputQuery
   461 // showGetInputQuery
   440 // ----------------------------------------------------------------------------
   462 // ----------------------------------------------------------------------------
   441 //
   463 //
   454     stopShowWaitNote();
   476     stopShowWaitNote();
   455     mMinLength = minLength;
   477     mMinLength = minLength;
   456     
   478     
   457     if (mGetInputQuery){
   479     if (mGetInputQuery){
   458         delete mGetInputQuery;
   480         delete mGetInputQuery;
   459         mGetInputQuery = NULL;        
   481         mGetInputQuery = NULL;
   460     }    
   482     }    
   461     mGetInputQuery = new HbInputDialog();
   483     mGetInputQuery = new HbInputDialog();
   462     mGetInputQuery->setPromptText(heading);
   484     mGetInputQuery->setPromptText(heading);
   463     QVariant vContent(content);
   485     QVariant vContent(content);
   464     mGetInputQuery->setValue(vContent);
   486     mGetInputQuery->setValue(vContent);
   469         inputMode.setFilter(HbPhoneNumberFilter::instance());
   491         inputMode.setFilter(HbPhoneNumberFilter::instance());
   470     } else {
   492     } else {
   471         // char mode
   493         // char mode
   472         inputMode.setUpAsLatinAlphabetOnlyEditor();
   494         inputMode.setUpAsLatinAlphabetOnlyEditor();
   473     }
   495     }
   474     connect(mGetInputQuery->lineEdit(), SIGNAL(textChanged(QString)),
   496     
   475         this, SLOT(updateQueryAction(QString)));
       
   476     mGetInputQuery->lineEdit()->setMaxLength(maxLength);
   497     mGetInputQuery->lineEdit()->setMaxLength(maxLength);
   477 
   498 
   478     composeDialog(mGetInputQuery, KDefaultSelectionTimeoutMseconds, ESatDialogGetInput);
   499     composeDialog(mGetInputQuery, KDefaultSelectionTimeoutMseconds, ESatDialogGetInput);
   479     // Sets the "OK"-action/button
   500     // Sets the "OK"-action/button
   480     if ((0 == minLength || content.length() >= minLength) && 
   501     if ((0 == minLength || content.length() >= minLength) && 
   482         mGetInputQuery->actions().at(0)->setEnabled(true);
   503         mGetInputQuery->actions().at(0)->setEnabled(true);
   483     } 
   504     } 
   484 
   505 
   485     if (aHideInput) {
   506     if (aHideInput) {
   486         mGetInputQuery->lineEdit()->setEchoMode(HbLineEdit::Password);
   507         mGetInputQuery->lineEdit()->setEchoMode(HbLineEdit::Password);
   487         TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery hide")
   508         
       
   509         bool res = connect(mGetInputQuery->lineEdit(), 
       
   510             SIGNAL(contentsChanged()), this, SLOT(contentChanged()));
       
   511         TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetInputQuery \
       
   512                      connect %d",res);
       
   513     }else {
       
   514         connect(mGetInputQuery->lineEdit(), SIGNAL(textChanged(QString)),
       
   515             this, SLOT(updateQueryAction(QString)));        
   488     }
   516     }
   489 
   517 
   490     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery before pop")
   518     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery before pop")
   491     DialogWaiter waiter;
   519     DialogWaiter waiter;
   492     mGetInputQuery->open(&waiter, SLOT(done(HbAction *)));
   520     mGetInputQuery->open(&waiter, SLOT(done(HbAction *)));
   493     waiter.wait();
   521     waiter.wait();
   494     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery end pop")
   522     TFLOGSTRING("SATAPP: SatAppUiProvider::showGetInputQuery end pop")
   495 
   523 
   496     content = (mGetInputQuery->value()).toString();
   524     content = (mGetInputQuery->value()).toString();
   497     
   525     
   498 #ifndef _DEBUG
   526 #ifndef __WINS__
   499     delete mGetInputQuery;
   527     delete mGetInputQuery;
   500     mGetInputQuery = 0;
   528     mGetInputQuery = 0;
   501 #endif    
   529 #endif
   502 
   530 
   503     TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetInputQuery mUserRsp =%d exit",
   531     TFLOGSTRING2("SATAPP: SatAppUiProvider::showGetInputQuery mUserRsp =%d exit",
   504             mUserRsp)
   532             mUserRsp)
   505     return mUserRsp;
   533     return mUserRsp;
       
   534 }
       
   535 
       
   536 // ----------------------------------------------------------------------------
       
   537 // SatAppInputProvider::contentChanged
       
   538 // Called when editor field is modified
       
   539 // ----------------------------------------------------------------------------
       
   540 //
       
   541 void SatAppUiProvider::contentChanged()
       
   542 {
       
   543     if (mGetInputQuery) {
       
   544         QString content = (mGetInputQuery->value()).toString();
       
   545         updateQueryAction(content);
       
   546     }
   506 }
   547 }
   507 
   548 
   508 // ----------------------------------------------------------------------------
   549 // ----------------------------------------------------------------------------
   509 // Called when editor field is modified
   550 // Called when editor field is modified
   510 // ----------------------------------------------------------------------------
   551 // ----------------------------------------------------------------------------
   518             mGetInputQuery->actions().at(0)->setEnabled(true);
   559             mGetInputQuery->actions().at(0)->setEnabled(true);
   519         } else {
   560         } else {
   520             mGetInputQuery->actions().at(0)->setEnabled(false);
   561             mGetInputQuery->actions().at(0)->setEnabled(false);
   521         }
   562         }
   522     }
   563     }
   523     
   564 
   524     // Get InKey
   565     // Get InKey
   525     if (mGetInkeyQuery && mGetInkeyQuery->actions().at(0)) {
   566     if (mGetInkeyQuery && mGetInkeyQuery->actions().at(0)) {
   526         if (1 == text.length()) {
   567         if (1 == text.length()) {
   527             mGetInkeyQuery->actions().at(0)->setEnabled(true);
   568             mGetInkeyQuery->actions().at(0)->setEnabled(true);
   528         } else {
   569         } else {
   529             mGetInkeyQuery->actions().at(0)->setEnabled(false); 
   570             mGetInkeyQuery->actions().at(0)->setEnabled(false); 
   530         }
   571         }
   531     }
   572     }
   532 
   573     if (mImmediateQuery) {
       
   574         TFLOGSTRING("SATAPP: SatAppUiProvider::updateQueryAction \
       
   575             digital immediate")
       
   576         immediateResponse(text);
       
   577     }
   533     TFLOGSTRING("SATAPP: SatAppUiProvider::updateQueryAction exit")
   578     TFLOGSTRING("SATAPP: SatAppUiProvider::updateQueryAction exit")
   534 }
   579 }
   535 
   580 
   536 // ----------------------------------------------------------------------------
   581 // ----------------------------------------------------------------------------
   537 // showConfirmSendQuery
   582 // showConfirmSendQuery
   544     TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSendQuery call")
   589     TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSendQuery call")
   545     resetUserResponse();
   590     resetUserResponse();
   546     
   591     
   547     if (mConfirmSendQuery){
   592     if (mConfirmSendQuery){
   548         delete mConfirmSendQuery;
   593         delete mConfirmSendQuery;
   549         mConfirmSendQuery = NULL;        
   594         mConfirmSendQuery = NULL;
   550     }
   595     }
   551     
       
   552     mConfirmSendQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
   596     mConfirmSendQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
   553     if(mConfirmSendQuery) {
   597     if(mConfirmSendQuery) {
   554         mConfirmSendQuery->setText(aText);        
   598         mConfirmSendQuery->setText(aText);
   555         composeDialog(mConfirmSendQuery, 0, ESatDialogConfirmSend);
   599         composeDialog(mConfirmSendQuery, 0, ESatDialogConfirmSend);
   556 
   600 
   557         TFLOGSTRING("SATAPP: SatAppUiProvider::confirmSend before open")
   601         TFLOGSTRING("SATAPP: SatAppUiProvider::confirmSend before open")
   558         DialogWaiter waiter;
   602         DialogWaiter waiter;
   559         mConfirmSendQuery->open(&waiter, SLOT(done(HbAction *)));
   603         mConfirmSendQuery->open(&waiter, SLOT(done(HbAction *)));
   560         waiter.wait();
   604         waiter.wait();
   561         TFLOGSTRING("SATAPP: SatAppUiProvider::confirmSend after open")
   605         TFLOGSTRING("SATAPP: SatAppUiProvider::confirmSend after open")
   562         
   606         
   563 #ifndef _DEBUG
   607 #ifndef __WINS__
   564         delete mConfirmSendQuery;
   608         delete mConfirmSendQuery;
   565         mConfirmSendQuery = 0;
   609         mConfirmSendQuery = 0;
   566 #endif        
   610 #endif
   567     }
   611     }
   568     aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false;
   612     aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false;
   569     TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSendQuery exit")
   613     TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSendQuery exit")
   570 }
   614 }
   571 
   615 
   676         TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery length 0")
   720         TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery length 0")
   677     } else {
   721     } else {
   678         alphaId.append(aText);
   722         alphaId.append(aText);
   679         TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery exit")
   723         TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery exit")
   680     }
   724     }
   681     
       
   682     if (mSetUpCallQuery){
   725     if (mSetUpCallQuery){
   683         delete mSetUpCallQuery;
   726         delete mSetUpCallQuery;
   684         mSetUpCallQuery = NULL;
   727         mSetUpCallQuery = NULL;
   685     }
   728     }
   686     
   729     
   687     mSetUpCallQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
   730     mSetUpCallQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
   688     if(mSetUpCallQuery) {
   731     if(mSetUpCallQuery) {
   689         mSetUpCallQuery->setText(alphaId);  
   732         mSetUpCallQuery->setText(alphaId);
   690         
       
   691         composeDialog(mSetUpCallQuery, 0, ESatDialogSetUpCall);
   733         composeDialog(mSetUpCallQuery, 0, ESatDialogSetUpCall);
   692 
   734 
   693         TFLOGSTRING("SATAPP: SatAppSetUpCall::showSetUpCallConfirm before open")
   735         TFLOGSTRING("SATAPP: SatAppSetUpCall::showSetUpCallConfirm before open")
   694         DialogWaiter waiter;
   736         DialogWaiter waiter;
   695         mSetUpCallQuery->open(&waiter, SLOT(done(HbAction *)));
   737         mSetUpCallQuery->open(&waiter, SLOT(done(HbAction *)));
   696         waiter.wait();
   738         waiter.wait();
   697         TFLOGSTRING("SATAPP: SatAppSetUpCall::showSetUpCallConfirm after open")
   739         TFLOGSTRING("SATAPP: SatAppSetUpCall::showSetUpCallConfirm after open")
   698         
   740         
   699 #ifndef _DEBUG
   741 #ifndef __WINS__
   700         delete mSetUpCallQuery;
   742         delete mSetUpCallQuery;
   701         mSetUpCallQuery = 0;
   743         mSetUpCallQuery = 0;
   702 #endif        
   744 #endif
   703     }
   745     }
   704     aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false;
   746     aActionAccepted = (EUserPrimaryResponse == mUserRsp) ? true : false;
   705     TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery exit")
   747     TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmSetUpCallQUery exit")
   706 }
   748 }
   707 
   749 
   711 //
   753 //
   712 void SatAppUiProvider::clearScreen()
   754 void SatAppUiProvider::clearScreen()
   713 {
   755 {
   714     TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen called")
   756     TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen called")
   715     if (mDisplayPopup) {
   757     if (mDisplayPopup) {
       
   758         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen DisplayText")
   716         mDisplayPopup->close();
   759         mDisplayPopup->close();
   717         mDisplayPopup = NULL;
   760         mDisplayPopup = NULL;
   718         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen DisplayText")
       
   719     }
   761     }
   720     if (mGetInkeyQuery) {
   762     if (mGetInkeyQuery) {
       
   763         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen GetInkey")
   721         mGetInkeyQuery->close();
   764         mGetInkeyQuery->close();
   722         mGetInkeyQuery = NULL;
   765         mGetInkeyQuery = NULL;
   723         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen GetInkey")
   766     }
   724     }
   767 
   725     if (mYesNoPopup) {
   768     if (mYesNoPopup) {
       
   769         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen mYesNoPopup")
   726         mYesNoPopup->close();
   770         mYesNoPopup->close();
   727         mYesNoPopup = NULL;
   771         delete mYesNoPopup;
   728         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen GetYesNo")
   772         mYesNoPopup = 0;
   729     }
   773     }
       
   774 
       
   775     if (mImmediateQuery) {
       
   776         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen mImmediateQuery")
       
   777         mImmediateQuery->close();
       
   778         mImmediateQuery = NULL;
       
   779     }
       
   780 
   730     if (mGetInputQuery) {
   781     if (mGetInputQuery) {
       
   782         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen GetInput")
   731         mGetInputQuery->close();
   783         mGetInputQuery->close();
   732         mGetInputQuery = NULL;
   784         mGetInputQuery = NULL;
   733         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen GetInput")
   785     }
   734     }
   786 
   735     if(mConfirmSendQuery) {
   787     if(mConfirmSendQuery) {
       
   788         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen ConfirmSend")
   736         mConfirmSendQuery->close();
   789         mConfirmSendQuery->close();
   737         mConfirmSendQuery = NULL;
   790         mConfirmSendQuery = NULL;
   738         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen ConfirmSend")
   791     }
   739     }
   792 
   740     if (mSetUpCallQuery) {
   793     if (mSetUpCallQuery) {
       
   794         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen SetUpCall")
   741         mSetUpCallQuery->close();
   795         mSetUpCallQuery->close();
   742         mSetUpCallQuery = NULL;
   796         mSetUpCallQuery = NULL;
   743         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen SetUpCall")
   797     }
   744     }
   798 
   745     if (mCallControlMsg){
   799     if (mCallControlMsg){
       
   800         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen CallControlMsg")
   746         mCallControlMsg->close();
   801         mCallControlMsg->close();
   747         mCallControlMsg = NULL;
   802         mCallControlMsg = NULL;
   748         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen CallControlMsg")
   803     }
   749     }
   804 
   750     if (mConfirmBipQuery){
   805     if (mConfirmBipQuery){
       
   806         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen ConfirmBip")
   751         mConfirmBipQuery->close();
   807         mConfirmBipQuery->close();
   752         mConfirmBipQuery = NULL;
   808         mConfirmBipQuery = NULL;
   753         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen ConfirmBip")
   809     }
   754     }
   810 
   755     if (mWaitNote){
   811     if (mWaitNote){
       
   812         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen WaitNote")
   756         mWaitNote->close();
   813         mWaitNote->close();
   757         mWaitNote = NULL;
   814         mWaitNote = NULL;
   758         TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen WaitNote")
       
   759     }
   815     }
   760     mUserRsp = EUserClearResponse;
   816     mUserRsp = EUserClearResponse;
   761     TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen exit")
   817     TFLOGSTRING("SATAPP: SatAppUiProvider::clearScreen exit")
   762 }
   818 }
   763 
   819 
   773     QCoreApplication::instance()->quit();
   829     QCoreApplication::instance()->quit();
   774     TFLOGSTRING("SATAPP: SatAppUiProvider::closeUi exit")
   830     TFLOGSTRING("SATAPP: SatAppUiProvider::closeUi exit")
   775 }
   831 }
   776 
   832 
   777 // ----------------------------------------------------------------------------
   833 // ----------------------------------------------------------------------------
   778 // digitalResponse
       
   779 // ----------------------------------------------------------------------------
       
   780 //
       
   781 void SatAppUiProvider::digitalResponse(const int aKey)
       
   782 {
       
   783     TFLOGSTRING("SATAPP: SatAppGetInkey::digitalResponse call")
       
   784     mDigitalRsp = aKey;
       
   785     if (mYesNoPopup){
       
   786         TFLOGSTRING("SATAPP: SatAppUiProvider::digitalResponse Close")
       
   787         mYesNoPopup->close();
       
   788         }
       
   789     TFLOGSTRING("SATAPP: SatAppUiProvider::digitalResponse exit")
       
   790 }
       
   791 
       
   792 // ----------------------------------------------------------------------------
       
   793 // resetUserResponse
   834 // resetUserResponse
   794 // ----------------------------------------------------------------------------
   835 // ----------------------------------------------------------------------------
   795 //
   836 //
   796 void SatAppUiProvider::resetUserResponse()
   837 void SatAppUiProvider::resetUserResponse()
   797 {
   838 {
   798     TFLOGSTRING("SATAPP: SatAppUiProvider::resetUserResponse call")
   839     TFLOGSTRING("SATAPP: SatAppUiProvider::resetUserResponse call")
   799     mUserRsp = EUserNoResponse;
   840     mUserRsp = EUserNoResponse;
   800     mDigitalRsp = 0;
   841     mDigitalRsp = Qt::Key_unknown;
   801     mMinLength = 0;
   842     mMinLength = 0;
   802     TFLOGSTRING("SATAPP: SatAppUiProvider::resetUserResponse exit")
   843     TFLOGSTRING("SATAPP: SatAppUiProvider::resetUserResponse exit")
   803 }
   844 }
   804 
   845 
   805 // ----------------------------------------------------------------------------
   846 // ----------------------------------------------------------------------------
   834     HbAction *secondaryAction = new HbAction(dlg);
   875     HbAction *secondaryAction = new HbAction(dlg);
   835     dlg->addAction(secondaryAction);
   876     dlg->addAction(secondaryAction);
   836     ret = connect(secondaryAction, SIGNAL(triggered()),
   877     ret = connect(secondaryAction, SIGNAL(triggered()),
   837                   this, SLOT(userSecondaryResponse()));
   878                   this, SLOT(userSecondaryResponse()));
   838     TFLOGSTRING2("SATAPP: SatAppUiProvider::composeDialog \
   879     TFLOGSTRING2("SATAPP: SatAppUiProvider::composeDialog \
   839         secondaryAction=%d", ret)     
   880         secondaryAction=%d", ret)
   840     
   881     
   841     if (ESatDialogDisplayText == type){
   882     if (ESatDialogDisplayText == type){
   842         primaryAction->setText(hbTrId("txt_sat_general_ok"));
   883         primaryAction->setText(hbTrId("txt_sat_general_ok"));
   843         secondaryAction->setText(hbTrId("txt_sat_general_back"));
   884         secondaryAction->setText(hbTrId("txt_sat_general_back"));
   844         TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
   885         TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
   861         TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
   902         TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
   862             ESatDialogGetYesNo")
   903             ESatDialogGetYesNo")
   863     } else if (ESatDialogGetDigitalRsp == type){
   904     } else if (ESatDialogGetDigitalRsp == type){
   864         dlg->removeAction(primaryAction);
   905         dlg->removeAction(primaryAction);
   865         secondaryAction->setText(hbTrId("txt_sat_general_cancel"));
   906         secondaryAction->setText(hbTrId("txt_sat_general_cancel"));
       
   907         ret = connect(secondaryAction, SIGNAL(triggered()),
       
   908                       this, SLOT(handleImmediateCancel()));
       
   909         TFLOGSTRING2("SATAPP: SatAppUiProvider::composeDialog \
       
   910             con secondaryAction=%d", ret)
   866         TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
   911         TFLOGSTRING("SATAPP: SatAppUiProvider::composeDialog \
   867             ESatDialogGetDigitalRsp")
   912             ESatDialogGetDigitalRsp")
   868     } else if (ESatDialogSetUpCall == type){
   913     } else if (ESatDialogSetUpCall == type){
   869         primaryAction->setText(hbTrId("txt_sat_general_call"));
   914         primaryAction->setText(hbTrId("txt_sat_general_call"));
   870         secondaryAction->setText(hbTrId("txt_sat_general_cancel"));
   915         secondaryAction->setText(hbTrId("txt_sat_general_cancel"));
  1040 void SatAppUiProvider::showConfirmOpenChannelQuery(
  1085 void SatAppUiProvider::showConfirmOpenChannelQuery(
  1041         const QString &aText,
  1086         const QString &aText,
  1042         bool &aActionAccepted)
  1087         bool &aActionAccepted)
  1043 {
  1088 {
  1044     TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery call")
  1089     TFLOGSTRING("SATAPP: SatAppUiProvider::showConfirmOpenChannelQuery call")
       
  1090     stopShowWaitNote();
       
  1091     if (mConfirmBipQuery){
       
  1092         delete mConfirmBipQuery;
       
  1093         mConfirmBipQuery = NULL;
       
  1094     }
  1045     QString title = aText;
  1095     QString title = aText;
  1046     if (!aText.length()){
  1096     if (!aText.length()){
  1047         title = hbTrId("txt_sat_openchannel_confirm_note");
  1097         title = hbTrId("txt_sat_openchannel_confirm_note");
  1048     }
  1098     }
  1049 
  1099 
  1155     TFLOGSTRING("SATAPP: SatAppUiProvider::showSatInfoNote")
  1205     TFLOGSTRING("SATAPP: SatAppUiProvider::showSatInfoNote")
  1156     HbMessageBox::information(aText);
  1206     HbMessageBox::information(aText);
  1157     TFLOGSTRING("SATAPP: SatAppUiProvider::showSatInfoNote exit")
  1207     TFLOGSTRING("SATAPP: SatAppUiProvider::showSatInfoNote exit")
  1158 }
  1208 }
  1159 
  1209 
       
  1210 
       
  1211 // ----------------------------------------------------------------------------
       
  1212 //handleImmediateCancel
       
  1213 //
       
  1214 // ----------------------------------------------------------------------------
       
  1215 //
       
  1216 void SatAppUiProvider::handleImmediateCancel()
       
  1217 {
       
  1218     TFLOGSTRING("SATAPP: SatAppUiProvider::handleImmediateCancel")
       
  1219     if (mLoop && mLoop->isRunning()) {
       
  1220         mLoop->quit();
       
  1221     }
       
  1222     TFLOGSTRING("SATAPP: SatAppUiProvider::handleImmediateCancel exit")
       
  1223 }
       
  1224 
       
  1225 // ----------------------------------------------------------------------------
       
  1226 //immediateResponse
       
  1227 //
       
  1228 // ----------------------------------------------------------------------------
       
  1229 //
       
  1230 void SatAppUiProvider::immediateResponse(QString text)
       
  1231 {
       
  1232     TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse")
       
  1233     if (mLoop && mLoop->isRunning()) {
       
  1234         mLoop->quit();
       
  1235     }
       
  1236     if ("0" == text) {
       
  1237         mDigitalRsp = Qt::Key_0;
       
  1238         TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 0")
       
  1239     } else if ("1" == text) {
       
  1240         mDigitalRsp = Qt::Key_1;
       
  1241         TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 1")
       
  1242     } else if ("2" == text) {
       
  1243         mDigitalRsp = Qt::Key_2;
       
  1244         TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 2")
       
  1245     } else if ("3" == text) {
       
  1246         mDigitalRsp = Qt::Key_3;
       
  1247         TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 3")
       
  1248     } else if ("4" == text) {
       
  1249         mDigitalRsp = Qt::Key_4;
       
  1250         TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 4")
       
  1251     }else if ("5" == text) {
       
  1252         mDigitalRsp = Qt::Key_5;
       
  1253         TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 5")
       
  1254     } else if ("6" == text) {
       
  1255         mDigitalRsp = Qt::Key_6;
       
  1256         TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 6")
       
  1257     } else if ("7" == text) {
       
  1258         mDigitalRsp = Qt::Key_7;
       
  1259         TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 7")
       
  1260     } else if ("8" == text) {
       
  1261         mDigitalRsp = Qt::Key_8;
       
  1262         TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 8")
       
  1263     } else if ("9" == text) {
       
  1264         mDigitalRsp = Qt::Key_9;
       
  1265         TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse 9")
       
  1266     } else if ("+" == text) {
       
  1267         mDigitalRsp = Qt::Key_Plus;
       
  1268         TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse +")
       
  1269     } else if ("*" == text) {
       
  1270         mDigitalRsp = Qt::Key_Asterisk;
       
  1271         TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse *")
       
  1272     } else if ("#" == text) {
       
  1273         mDigitalRsp = Qt::Key_NumberSign;
       
  1274         TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse #")
       
  1275     }
       
  1276     mUserRsp = EUserPrimaryResponse;
       
  1277     TFLOGSTRING2("SATAPP: SatAppUiProvider::immediateResponse key %x",
       
  1278         mDigitalRsp)
       
  1279 
       
  1280     TFLOGSTRING("SATAPP: SatAppUiProvider::immediateResponse exit")
       
  1281 }
       
  1282 
  1160 // End of file
  1283 // End of file