phoneapp/phoneuiqtviewadapter/src/phonenotecontroller.cpp
changeset 30 ebdbd102c78a
parent 27 2f8f8080a020
child 51 f39ed5e045e0
equal deleted inserted replaced
27:2f8f8080a020 30:ebdbd102c78a
    67     }
    67     }
    68     
    68     
    69     QString noteString = globalNoteText(globalNoteParam);
    69     QString noteString = globalNoteText(globalNoteParam);
    70     
    70     
    71     if (false == noteString.isNull()) {
    71     if (false == noteString.isNull()) {
    72         if (globalNoteParam->WaitForReady()) {
    72         bool showNote(true);
    73             HbDeviceMessageBox messageBox(noteString, type);
    73         for (int i = 0; i < m_messageBoxList.count(); ++i) {
    74             messageBox.setTimeout(HbDialog::StandardTimeout);
    74             // Do not show same note/text several times, e.g when user hits
    75             messageBox.exec();
    75             // the end button several times we should show only one "not allowed"
    76         } else {
    76             // note.
    77             bool showNote(true);
    77             if (noteString == m_messageBoxList.at(i)->text()) {
    78             for (int i = 0;i<m_messageBoxList.count(); ++i) {
    78                 showNote = false;
    79                 // Do not show same note/text several times, e.g when user hits
    79                 break;
    80                 // the end button several times we should show only one "not allowed"
    80             }
    81                 // note.
    81         }
    82                 if (noteString == m_messageBoxList.at(i)->text()) {
    82         
    83                     showNote = false;
    83         if (showNote) {
    84                     break;
    84             QScopedPointer<HbDeviceMessageBox> messageBox( 
    85                 }
    85                 new HbDeviceMessageBox(noteString, type));
    86             }
    86             
    87             
    87             int timeout = globalNoteParam->Timeout();
    88             if (showNote) {
    88             if (timeout == 0) {
    89                 HbDeviceMessageBox *messageBox = new HbDeviceMessageBox(
       
    90                         noteString, type);
       
    91                 messageBox->setTimeout(HbDialog::StandardTimeout);
    89                 messageBox->setTimeout(HbDialog::StandardTimeout);
    92                 m_messageBoxList.append(messageBox);
    90             } else {
    93                 
    91                 messageBox->setTimeout(timeout);
    94                 if (1 == m_messageBoxList.size()) {
    92             }
    95                     QObject::connect(messageBox, SIGNAL(aboutToClose()), 
    93             
    96                                      this, SLOT(destroyDialog()));            
    94             HbDeviceMessageBox *messageBoxPtr = messageBox.data();
    97                     messageBox->show();
    95             m_messageBoxList.append(messageBoxPtr);
    98                 }
    96             messageBox.take();
       
    97             
       
    98             if (1 == m_messageBoxList.size()) {
       
    99                 QObject::connect(messageBoxPtr, SIGNAL(aboutToClose()), 
       
   100                                  this, SLOT(destroyDialog()));
       
   101                 messageBoxPtr->show();
    99             }
   102             }
   100         }
   103         }
   101     }
   104     }
   102 }
   105 }
   103 
   106 
   161         m_timer->stop();
   164         m_timer->stop();
   162     }
   165     }
   163     
   166     
   164     if (m_progressDialog) {
   167     if (m_progressDialog) {
   165         m_queryCanceledCommand = -1;
   168         m_queryCanceledCommand = -1;
   166         m_progressDialog->cancel();
   169         m_progressDialog->close();
   167     }
   170     }
   168 }
   171 }
   169 
   172 
   170 void PhoneNoteController::destroyDialog()
   173 void PhoneNoteController::destroyDialog()
   171 {
   174 {
   220 void PhoneNoteController::queryTimeout()
   223 void PhoneNoteController::queryTimeout()
   221 {
   224 {
   222     int sendCommand = m_timeoutCommand;
   225     int sendCommand = m_timeoutCommand;
   223     if (m_progressDialog) {
   226     if (m_progressDialog) {
   224         m_queryCanceledCommand = -1;
   227         m_queryCanceledCommand = -1;
   225         m_progressDialog->cancel();
   228         m_progressDialog->close();
   226     }
   229     }
   227     if (sendCommand != -1) {        
   230     if (sendCommand != -1) {        
   228         emit command(sendCommand);
   231         emit command(sendCommand);
   229     }
   232     }
   230 }
   233 }
   272             m_dtmfNote = new HbProgressDialog(HbProgressDialog::ProgressDialog);
   275             m_dtmfNote = new HbProgressDialog(HbProgressDialog::ProgressDialog);
   273             m_dtmfNote->setText( QString::fromUtf16(noteParam->Text().Ptr(), 
   276             m_dtmfNote->setText( QString::fromUtf16(noteParam->Text().Ptr(), 
   274                     noteParam->Text().Length()) ); 
   277                     noteParam->Text().Length()) ); 
   275                   
   278                   
   276             connect(hbactions.at(0), SIGNAL(triggered()), m_signalMapper, SLOT(map()));
   279             connect(hbactions.at(0), SIGNAL(triggered()), m_signalMapper, SLOT(map()));
   277             m_dtmfNote->setPrimaryAction(hbactions.at(0));
   280 
       
   281             int count = m_dtmfNote->actions().count();
       
   282             for (int i=count;0<i;i--) {
       
   283                 QAction *action = m_dtmfNote->actions().at(i-1);
       
   284                 m_dtmfNote->removeAction(action);
       
   285                 //TODO
       
   286                 //delete action;
       
   287             }
       
   288             m_dtmfNote->addAction(hbactions.at(0));
   278             m_signalMapper->setMapping(hbactions.at(0), hbactions.at(0)->data().toInt());
   289             m_signalMapper->setMapping(hbactions.at(0), hbactions.at(0)->data().toInt());
   279             
   290             
   280             QObject::connect(m_dtmfNote, SIGNAL(aboutToClose()), 
   291             QObject::connect(m_dtmfNote, SIGNAL(aboutToClose()), 
   281                              this, SLOT(removeMappings())); 
   292                              this, SLOT(removeMappings())); 
   282             
   293             
   307                 connect(hbactions.at(i), SIGNAL(triggered()), m_signalMapper, SLOT(map()));
   318                 connect(hbactions.at(i), SIGNAL(triggered()), m_signalMapper, SLOT(map()));
   308                 m_signalMapper->setMapping(hbactions.at(i), hbactions.at(i)->data().toInt());
   319                 m_signalMapper->setMapping(hbactions.at(i), hbactions.at(i)->data().toInt());
   309                 m_actions.append(hbactions.at(i));
   320                 m_actions.append(hbactions.at(i));
   310             }
   321             }
   311             
   322             
   312             if (hbactions.count() == 1) {
   323             int count = m_queryNote->actions().count();
   313                 m_queryNote->setPrimaryAction(hbactions.at(0));
   324             for (int i=count;0<i;i--) {
   314             } else if (hbactions.count() > 1) {
   325                 QAction *action = m_queryNote->actions().at(i-1);
   315                 m_queryNote->setPrimaryAction(hbactions.at(0));
   326                 m_queryNote->removeAction(action);
   316                 m_queryNote->setSecondaryAction(hbactions.at(1));
   327                 //TODO
       
   328                 //delete action;
       
   329             }
       
   330             
       
   331             for (int i=0;i<hbactions.count();i++) {
       
   332                 m_queryNote->addAction(hbactions.at(i));
   317             }
   333             }
   318             
   334             
   319             m_queryNote->show();
   335             m_queryNote->show();
   320         }
   336         }
   321     }
   337     }