phonesettings/cpphonesettingsplugins/callsplugin/src/cpcallsplugingroup.cpp
changeset 45 6b911d05207e
parent 37 ba76fc04e6c2
child 46 bc5a64e5bc3c
equal deleted inserted replaced
37:ba76fc04e6c2 45:6b911d05207e
    94     QObject::connect(
    94     QObject::connect(
    95         this, 
    95         this, 
    96         SIGNAL(cancelNote(int)),
    96         SIGNAL(cancelNote(int)),
    97         phoneNotes, 
    97         phoneNotes, 
    98         SLOT(cancelNote(int)));
    98         SLOT(cancelNote(int)));
       
    99     QObject::connect(
       
   100         this, 
       
   101         SIGNAL(showNotificationDialog(const QString&)),
       
   102         phoneNotes, 
       
   103         SLOT(showNotificationDialog(const QString&)));
    99     
   104     
   100     // Create combobox string <-> setting mappings 
   105     // Create combobox string <-> setting mappings 
   101     insertMappedListItems(); 
   106     insertMappedListItems(); 
   102        
   107        
   103     // Greate settings items
   108     // Greate settings items
   104     createCLIItem();
   109     createCLIItem();
   105     createCallWaitingtem();
   110     createCallWaitingtem();
   106     createSoftRejectItem();
   111     createSoftRejectItem();
   107     createShowCallDurationItem();
   112     createShowCallDurationItem();
       
   113     createOwnVideoInReceivedCall();
   108     
   114     
   109     // Connect setting item signals
   115     // Connect setting item signals
   110     connectCLIItem();
   116     connectCLIItem();
   111     connectCallWaitingItem();
   117     connectCallWaitingItem();
   112     connectSoftRejectItem();
   118     connectSoftRejectItem();
   113     connectShowCallDurationItem();
   119     connectShowCallDurationItem();
       
   120     connectOwnVideoInReceivedCall();
   114     
   121     
   115     m_callWaitingDistinguishEnabled = 
   122     m_callWaitingDistinguishEnabled = 
   116        m_cpSettingsWrapper->isFeatureCallWaitingDistiquishNotProvisionedEnabled();
   123        m_cpSettingsWrapper->isFeatureCallWaitingDistiquishNotProvisionedEnabled();
   117     
   124     
   118     DPRINT << ": OUT";
   125     DPRINT << ": OUT";
   222     
   229     
   223     DPRINT << ": OUT";
   230     DPRINT << ": OUT";
   224 }
   231 }
   225 
   232 
   226 /*!
   233 /*!
       
   234   CpCallsPluginGroup::createOwnVideoInReceivedCall.
       
   235  */
       
   236 void CpCallsPluginGroup::createOwnVideoInReceivedCall()
       
   237 {
       
   238     DPRINT << ": IN";
       
   239     
       
   240     // Read Own video in received call value from Cenrep 
       
   241     int ownVideoInReceivedCallStatus = 
       
   242             m_cpSettingsWrapper->readVtVideoSending();
       
   243     DPRINT << "ownVideoInReceivedCallStatus:" << ownVideoInReceivedCallStatus;
       
   244     
       
   245     m_OwnVideoInReceivedCall =
       
   246         new CpSettingFormItemData(
       
   247             HbDataFormModelItem::ComboBoxItem,
       
   248             hbTrId("txt_phone_setlabel_own_video_in_received_call"),
       
   249             this);
       
   250 
       
   251     QStringList ownVideoSelections;
       
   252     ownVideoSelections
       
   253         <<hbTrId("txt_phone_setlabel_own_video_in_val_show_automatic")
       
   254         <<hbTrId("txt_phone_setlabel_own_video_in_val_ask_first")
       
   255         <<hbTrId("txt_phone_setlabel_own_video_in_val_dont_show");
       
   256 
       
   257     m_OwnVideoInReceivedCall->setContentWidgetData(
       
   258         "items", QVariant(ownVideoSelections));
       
   259     
       
   260     QVariant indexValue(ownVideoInReceivedCallStatus);
       
   261     m_OwnVideoInReceivedCall->setContentWidgetData(
       
   262         QString("currentIndex"), indexValue);
       
   263     
       
   264     appendChild( m_OwnVideoInReceivedCall ); 
       
   265     DPRINT << ": OUT";    
       
   266 }
       
   267 
       
   268 /*!
   227   CpCallsPluginGroup::createCallWaitingtem.
   269   CpCallsPluginGroup::createCallWaitingtem.
   228  */
   270  */
   229 void CpCallsPluginGroup::createCallWaitingtem()
   271 void CpCallsPluginGroup::createCallWaitingtem()
   230 {
   272 {
   231     DPRINT << ": IN";
   273     DPRINT << ": IN";
   251 void CpCallsPluginGroup::connectShowCallDurationItem()
   293 void CpCallsPluginGroup::connectShowCallDurationItem()
   252 {
   294 {
   253     DPRINT << ": IN";
   295     DPRINT << ": IN";
   254     
   296     
   255     m_helper.addConnection(
   297     m_helper.addConnection(
   256         m_DataItemShowCallDuration, SIGNAL(clicked()),
   298         m_DataItemShowCallDuration, SIGNAL(valueChanged(QPersistentModelIndex, QVariant)),
   257         this, SLOT(showCallDurationStateChanged()));
   299         this, SLOT(showCallDurationStateChanged()));
   258 
   300 
   259     DPRINT << ": OUT";
   301     DPRINT << ": OUT";
   260 }
   302 }
   261  
   303  
   296     
   338     
   297     DPRINT << ": OUT";
   339     DPRINT << ": OUT";
   298 }
   340 }
   299 
   341 
   300 /*!
   342 /*!
       
   343   CpCallsPluginGroup::connectOwnVideoInReceivedCall.
       
   344  */
       
   345 void CpCallsPluginGroup::connectOwnVideoInReceivedCall()
       
   346 {
       
   347     DPRINT << ": IN";
       
   348         
       
   349     m_helper.addConnection(
       
   350         m_OwnVideoInReceivedCall, SIGNAL(currentIndexChanged(int)),
       
   351             this, SLOT(ownVideoInReceivedCallStateChanged(int)));
       
   352 
       
   353     DPRINT << ": OUT";
       
   354 }
       
   355 /*!
   301   CpCallsPluginGroup::connectCallWaitingItem.
   356   CpCallsPluginGroup::connectCallWaitingItem.
   302  */
   357  */
   303 void CpCallsPluginGroup::connectCallWaitingItem()
   358 void CpCallsPluginGroup::connectCallWaitingItem()
   304 {
   359 {
   305     DPRINT << ": IN";
   360     DPRINT << ": IN";
   306 
   361 
   307     m_helper.addConnection(
   362     m_helper.addConnection(
   308         m_DataItemCallWaiting, SIGNAL(clicked()),
   363         m_DataItemCallWaiting, SIGNAL(valueChanged(QPersistentModelIndex, QVariant)),
   309         this, SLOT(callWaitingCurrentIndexChanged()));
   364         this, SLOT(callWaitingCurrentIndexChanged()));
   310 
   365 
   311     DPRINT << ": OUT";
   366     DPRINT << ": OUT";
   312 }
   367 }
   313 
   368 
   319     DPRINT << ": IN";
   374     DPRINT << ": IN";
   320 
   375 
   321     QVariant text = m_DataItemShowCallDuration->contentWidgetData("text");
   376     QVariant text = m_DataItemShowCallDuration->contentWidgetData("text");
   322     QString showCallDurationText = text.toString();
   377     QString showCallDurationText = text.toString();
   323 
   378 
   324     if (showCallDurationText == hbTrId("txt_phone_setlabel_val_yes")) {
   379     if(m_cpSettingsWrapper->isOngoingCall()) {
   325         m_cpSettingsWrapper->setShowCallDuration(true);
   380         // ongoing call, operation not allowed, refresh ui.
   326     } else if (showCallDurationText == hbTrId("txt_phone_setlabel_val_no")){
   381         bool showCallDurationStatus = m_cpSettingsWrapper->showCallDuration();
   327         m_cpSettingsWrapper->setShowCallDuration(false);
   382         DPRINT << ": ongoing call case, status: " << showCallDurationStatus;
       
   383 
       
   384         if (showCallDurationStatus) {
       
   385             m_DataItemShowCallDuration->setContentWidgetData(
       
   386                 "text", QVariant(hbTrId("txt_phone_setlabel_val_yes")));
       
   387             m_DataItemShowCallDuration->setContentWidgetData(
       
   388                 "additionalText", QVariant(hbTrId("txt_phone_setlabel_val_no")));
       
   389         } else {
       
   390             m_DataItemShowCallDuration->setContentWidgetData(
       
   391                 "text", QVariant(hbTrId("txt_phone_setlabel_val_no")));
       
   392             m_DataItemShowCallDuration->setContentWidgetData(
       
   393                 "additionalText", QVariant(hbTrId("txt_phone_setlabel_val_yes")));
       
   394         }
       
   395         emit showGlobalNote(
       
   396             m_activeNoteId, 
       
   397             emit hbTrId("txt_phone_info_not_allowed"), 
       
   398             HbMessageBox::MessageTypeInformation);
   328     } else {
   399     } else {
   329         DPRINT << "nothing done";
   400         if (showCallDurationText == hbTrId("txt_phone_setlabel_val_yes")) {
       
   401             m_cpSettingsWrapper->setShowCallDuration(true);
       
   402         } else if (showCallDurationText == hbTrId("txt_phone_setlabel_val_no")){
       
   403             m_cpSettingsWrapper->setShowCallDuration(false);
       
   404         } else {
       
   405             DPRINT << "nothing done";
       
   406         }
   330     }
   407     }
   331 
   408 
   332     DPRINT << ": OUT";
   409     DPRINT << ": OUT";
   333 }
   410 }
   334 
   411 
   339 {
   416 {
   340     DPRINT << ": IN";
   417     DPRINT << ": IN";
   341     
   418     
   342     QVariant text = m_DataItemSoftRejectTextEditor->contentWidgetData("text");
   419     QVariant text = m_DataItemSoftRejectTextEditor->contentWidgetData("text");
   343     QString softRejectText = text.toString();  
   420     QString softRejectText = text.toString();  
   344     if (!softRejectText.isEmpty()) {
   421     if (!softRejectText.isNull()) {
   345         DPRINT << "softRejectText:" << softRejectText;
   422         DPRINT << "softRejectText:" << softRejectText;
   346         m_cpSettingsWrapper->writeSoftRejectText(softRejectText, true);
   423         m_cpSettingsWrapper->writeSoftRejectText(softRejectText, true);
   347     }
   424     }
   348 
   425 
   349     DPRINT << ": OUT";
   426     DPRINT << ": OUT";
   402         DPRINT << "Error: negative index!";
   479         DPRINT << "Error: negative index!";
   403     }
   480     }
   404 
   481 
   405     DPRINT << ": OUT";
   482     DPRINT << ": OUT";
   406 }
   483 }
   407     
   484 
       
   485 /*!
       
   486   CpCallsPluginGroup::ownVideoInReceivedCallStateChanged.
       
   487  */
       
   488 void CpCallsPluginGroup::ownVideoInReceivedCallStateChanged(int index)
       
   489 {
       
   490     DPRINT << ": IN : index: " << index;
       
   491     
       
   492     if (index >= 0) {
       
   493         //store to Cenrep
       
   494         int ret = m_cpSettingsWrapper->writeVtVideoSending(index);
       
   495         DPRINT << 
       
   496             "m_cpSettingsWrapper->writeVtVideoSending(index) ret: " << ret;
       
   497     }else{
       
   498         DPRINT << "Error: negative index!";
       
   499     }
       
   500            
       
   501     DPRINT << ": OUT";
       
   502 }
       
   503 
   408 /*!
   504 /*!
   409   CpCallsPluginGroup::insertMappedListItems.
   505   CpCallsPluginGroup::insertMappedListItems.
   410  */
   506  */
   411 void CpCallsPluginGroup::insertMappedListItems()
   507 void CpCallsPluginGroup::insertMappedListItems()
   412 {
   508 {
   439     }
   535     }
   440 
   536 
   441     if (m_callWaitingDistinguishEnabled &&
   537     if (m_callWaitingDistinguishEnabled &&
   442             PSetCallWaitingWrapper::StatusNotProvisioned == status) {
   538             PSetCallWaitingWrapper::StatusNotProvisioned == status) {
   443         DPRINT << ": not provisioned";
   539         DPRINT << ": not provisioned";
   444         emit showGlobalNote(m_activeNoteId,
   540         emit showNotificationDialog(hbTrId("txt_phone_info_request_not_completed"));
   445             hbTrId("txt_phone_info_request_not_completed"), 
       
   446             HbMessageBox::MessageTypeInformation);
       
   447     } else if (PSetCallWaitingWrapper::StatusActive == status && !alsCaseOnly) {
   541     } else if (PSetCallWaitingWrapper::StatusActive == status && !alsCaseOnly) {
   448         DPRINT << ": status active";
   542         DPRINT << ": status active";
   449         m_DataItemCallWaiting->setContentWidgetData(
   543         m_DataItemCallWaiting->setContentWidgetData(
   450             "text", QVariant(hbTrId("txt_phone_setlabel_call_waiting_val_on")));
   544             "text", QVariant(hbTrId("txt_phone_setlabel_call_waiting_val_on")));
   451         m_DataItemCallWaiting->setContentWidgetData(
   545         m_DataItemCallWaiting->setContentWidgetData(
   470     int result )
   564     int result )
   471 {
   565 {
   472     DPRINT << ": IN";
   566     DPRINT << ": IN";
   473     emit cancelNote(m_activeNoteId);
   567     emit cancelNote(m_activeNoteId);
   474     if (result) {
   568     if (result) {
   475         emit showGlobalNote(m_activeNoteId,
   569         emit showNotificationDialog(hbTrId("txt_phone_info_request_not_confirmed"));
   476             hbTrId("txt_phone_info_request_not_confirmed"), 
       
   477             HbMessageBox::MessageTypeWarning);
       
   478     } else {
   570     } else {
   479         switch (command){
   571         switch (command){
   480             case PSetCallWaitingWrapper::ActivateCallWaiting:
   572             case PSetCallWaitingWrapper::ActivateCallWaiting:
   481                 emit showGlobalNote(m_activeNoteId,
   573                 emit showNotificationDialog(hbTrId("txt_phone_info_call_waiting_activated"));
   482                     hbTrId("txt_phone_info_call_waiting_activated"), 
       
   483                     HbMessageBox::MessageTypeInformation);
       
   484                 break;
   574                 break;
   485             case PSetCallWaitingWrapper::DeactivateCallWaiting:
   575             case PSetCallWaitingWrapper::DeactivateCallWaiting:
   486                 emit showGlobalNote(m_activeNoteId,
   576                 emit showNotificationDialog(hbTrId("txt_phone_info_call_waiting_deactivated"));
   487                     hbTrId("txt_phone_info_call_waiting_deactivated"), 
       
   488                     HbMessageBox::MessageTypeInformation);
       
   489                 break;
   577                 break;
   490             default: 
   578             default: 
   491                 emit showGlobalNote(m_activeNoteId,
   579                 emit showNotificationDialog(hbTrId("txt_phone_info_result_unknown"));
   492                     hbTrId("txt_phone_info_result_unknown"), 
       
   493                     HbMessageBox::MessageTypeInformation);
       
   494                 break;
   580                 break;
   495         }
   581         }
   496     }
   582     }
   497     DPRINT << ": OUT";
   583     DPRINT << ": OUT";
   498 } 
   584 } 
   505     DPRINT << ": IN";
   591     DPRINT << ": IN";
   506     DPRINT << "ongoing:" << ongoing << ", interrupted:" << interrupted;
   592     DPRINT << "ongoing:" << ongoing << ", interrupted:" << interrupted;
   507     Q_ASSERT(!(ongoing && interrupted));
   593     Q_ASSERT(!(ongoing && interrupted));
   508     
   594     
   509     if (ongoing) {
   595     if (ongoing) {
   510         emit showGlobalProgressNote(m_activeNoteId, hbTrId("txt_phone_info_requesting"));
   596         emit showGlobalProgressNote(m_activeNoteId, hbTrId("txt_common_info_requesting"));
   511     }
   597     }
   512     
   598     
   513     if (interrupted) {
   599     if (interrupted) {
   514         emit cancelNote(m_activeNoteId);
   600         emit cancelNote(m_activeNoteId);
   515     }
   601     }