phonesettings/cpphonesettingsplugins/callsplugin/src/cpcallsplugingroup.cpp
branchGCC_SURGE
changeset 51 f39ed5e045e0
parent 30 ebdbd102c78a
parent 46 bc5a64e5bc3c
--- a/phonesettings/cpphonesettingsplugins/callsplugin/src/cpcallsplugingroup.cpp	Tue Jun 15 14:14:38 2010 +0100
+++ b/phonesettings/cpphonesettingsplugins/callsplugin/src/cpcallsplugingroup.cpp	Thu Jul 22 16:33:21 2010 +0100
@@ -96,6 +96,11 @@
         SIGNAL(cancelNote(int)),
         phoneNotes, 
         SLOT(cancelNote(int)));
+    QObject::connect(
+        this, 
+        SIGNAL(showNotificationDialog(const QString&)),
+        phoneNotes, 
+        SLOT(showNotificationDialog(const QString&)));
     
     // Create combobox string <-> setting mappings 
     insertMappedListItems(); 
@@ -105,12 +110,14 @@
     createCallWaitingtem();
     createSoftRejectItem();
     createShowCallDurationItem();
+    createOwnVideoInReceivedCall();
     
     // Connect setting item signals
     connectCLIItem();
     connectCallWaitingItem();
     connectSoftRejectItem();
     connectShowCallDurationItem();
+    connectOwnVideoInReceivedCall();
     
     m_callWaitingDistinguishEnabled = 
        m_cpSettingsWrapper->isFeatureCallWaitingDistiquishNotProvisionedEnabled();
@@ -148,7 +155,9 @@
             HbDataFormModelItem::ToggleValueItem,
             hbTrId("txt_phone_formlabel_show_call_duration"),
             this);
-
+    m_DataItemShowCallDuration->setObjectName(
+            "showCallDurationDataItem"); 
+    
     if (showCallDurationStatus) {
         m_DataItemShowCallDuration->setContentWidgetData(
             "text", QVariant(hbTrId("txt_phone_setlabel_val_yes")));
@@ -185,6 +194,9 @@
             HbDataFormModelItem::TextItem,
             hbTrId("txt_phone_setlabel_soft_reject"),
             this);
+    m_DataItemSoftRejectTextEditor->setObjectName(
+            "softRejectTextEditorDataItem");
+    
     m_DataItemSoftRejectTextEditor->setContentWidgetData(
         "text", QVariant(softRejectText));
     m_DataItemSoftRejectTextEditor->setContentWidgetData(
@@ -210,6 +222,8 @@
             HbDataFormModelItem::ComboBoxItem,
             hbTrId("txt_phone_setlabel_send_my_caller_id"),
             this);
+    m_DataItemCLI->setObjectName("cliDataItem");
+    
     // CLI combo box items string list 
     QStringList list;
     QMapIterator<int, QString> cliSettingMapIterator(m_cliSettingMap);
@@ -224,6 +238,43 @@
 }
 
 /*!
+  CpCallsPluginGroup::createOwnVideoInReceivedCall.
+ */
+void CpCallsPluginGroup::createOwnVideoInReceivedCall()
+{
+    DPRINT << ": IN";
+    
+    // Read Own video in received call value from Cenrep 
+    int ownVideoInReceivedCallStatus = 
+            m_cpSettingsWrapper->readVtVideoSending();
+    DPRINT << "ownVideoInReceivedCallStatus:" << ownVideoInReceivedCallStatus;
+    
+    m_OwnVideoInReceivedCall =
+        new CpSettingFormItemData(
+            HbDataFormModelItem::ComboBoxItem,
+            hbTrId("txt_phone_setlabel_own_video_in_received_call"),
+            this);
+    m_OwnVideoInReceivedCall->setObjectName(
+            "ownVideoInReceivedCallDataItem");
+    
+    QStringList ownVideoSelections;
+    ownVideoSelections
+        <<hbTrId("txt_phone_setlabel_own_video_in_val_show_automatic")
+        <<hbTrId("txt_phone_setlabel_own_video_in_val_ask_first")
+        <<hbTrId("txt_phone_setlabel_own_video_in_val_dont_show");
+
+    m_OwnVideoInReceivedCall->setContentWidgetData(
+        "items", QVariant(ownVideoSelections));
+    
+    QVariant indexValue(ownVideoInReceivedCallStatus);
+    m_OwnVideoInReceivedCall->setContentWidgetData(
+        QString("currentIndex"), indexValue);
+    
+    appendChild( m_OwnVideoInReceivedCall ); 
+    DPRINT << ": OUT";    
+}
+
+/*!
   CpCallsPluginGroup::createCallWaitingtem.
  */
 void CpCallsPluginGroup::createCallWaitingtem()
@@ -235,7 +286,7 @@
             HbDataFormModelItem::ToggleValueItem,
             hbTrId("txt_phone_setlabel_call_waiting"),
             this);
-
+    m_DataItemCallWaiting->setObjectName("callWaitingDataItem"); 
     m_DataItemCallWaiting->setContentWidgetData(
         "text", QVariant(hbTrId("txt_phone_setlabel_call_waiting_val_check_status")));
     m_DataItemCallWaiting->setContentWidgetData(
@@ -250,13 +301,10 @@
  */
 void CpCallsPluginGroup::connectShowCallDurationItem()
 {
-    DPRINT << ": IN";
-    
+    DPRINT;
     m_helper.addConnection(
-        m_DataItemShowCallDuration, SIGNAL(clicked()),
+        m_DataItemShowCallDuration, SIGNAL(valueChanged(QPersistentModelIndex, QVariant)),
         this, SLOT(showCallDurationStateChanged()));
-
-    DPRINT << ": OUT";
 }
  
 /*!
@@ -264,13 +312,10 @@
  */
 void CpCallsPluginGroup::connectSoftRejectItem()
 {
-    DPRINT << ": IN";
-
+    DPRINT;
     m_helper.addConnection(
         m_DataItemSoftRejectTextEditor, SIGNAL(editingFinished()),
         this, SLOT(softRejectTextChanged()));
-
-    DPRINT << ": OUT";
 }
 
 /*!
@@ -278,8 +323,7 @@
  */
 void CpCallsPluginGroup::connectCLIItem()
 {
-    DPRINT << ": IN";
-    
+    DPRINT;
     m_helper.addConnection(
         m_DataItemCLI, SIGNAL(currentIndexChanged(int)),
         this, SLOT(cliCurrentIndexChanged(int)));
@@ -293,8 +337,17 @@
     } else {
         DPRINT << "Error: " << err;
     }
-    
-    DPRINT << ": OUT";
+}
+
+/*!
+  CpCallsPluginGroup::connectOwnVideoInReceivedCall.
+ */
+void CpCallsPluginGroup::connectOwnVideoInReceivedCall()
+{
+    DPRINT;
+    m_helper.addConnection(
+        m_OwnVideoInReceivedCall, SIGNAL(currentIndexChanged(int)),
+            this, SLOT(ownVideoInReceivedCallStateChanged(int)));
 }
 
 /*!
@@ -302,13 +355,10 @@
  */
 void CpCallsPluginGroup::connectCallWaitingItem()
 {
-    DPRINT << ": IN";
-
+    DPRINT;
     m_helper.addConnection(
-        m_DataItemCallWaiting, SIGNAL(clicked()),
+        m_DataItemCallWaiting, SIGNAL(valueChanged(QPersistentModelIndex, QVariant)),
         this, SLOT(callWaitingCurrentIndexChanged()));
-
-    DPRINT << ": OUT";
 }
 
 /*!
@@ -321,12 +371,34 @@
     QVariant text = m_DataItemShowCallDuration->contentWidgetData("text");
     QString showCallDurationText = text.toString();
 
-    if (showCallDurationText == hbTrId("txt_phone_setlabel_val_yes")) {
-        m_cpSettingsWrapper->setShowCallDuration(true);
-    } else if (showCallDurationText == hbTrId("txt_phone_setlabel_val_no")){
-        m_cpSettingsWrapper->setShowCallDuration(false);
+    if(m_cpSettingsWrapper->isOngoingCall()) {
+        // ongoing call, operation not allowed, refresh ui.
+        bool showCallDurationStatus = m_cpSettingsWrapper->showCallDuration();
+        DPRINT << ": ongoing call case, status: " << showCallDurationStatus;
+
+        if (showCallDurationStatus) {
+            m_DataItemShowCallDuration->setContentWidgetData(
+                "text", QVariant(hbTrId("txt_phone_setlabel_val_yes")));
+            m_DataItemShowCallDuration->setContentWidgetData(
+                "additionalText", QVariant(hbTrId("txt_phone_setlabel_val_no")));
+        } else {
+            m_DataItemShowCallDuration->setContentWidgetData(
+                "text", QVariant(hbTrId("txt_phone_setlabel_val_no")));
+            m_DataItemShowCallDuration->setContentWidgetData(
+                "additionalText", QVariant(hbTrId("txt_phone_setlabel_val_yes")));
+        }
+        emit showGlobalNote(
+            m_activeNoteId, 
+            emit hbTrId("txt_phone_info_not_allowed"), 
+            HbMessageBox::MessageTypeInformation);
     } else {
-        DPRINT << "nothing done";
+        if (showCallDurationText == hbTrId("txt_phone_setlabel_val_yes")) {
+            m_cpSettingsWrapper->setShowCallDuration(true);
+        } else if (showCallDurationText == hbTrId("txt_phone_setlabel_val_no")){
+            m_cpSettingsWrapper->setShowCallDuration(false);
+        } else {
+            DPRINT << "nothing done";
+        }
     }
 
     DPRINT << ": OUT";
@@ -341,7 +413,7 @@
     
     QVariant text = m_DataItemSoftRejectTextEditor->contentWidgetData("text");
     QString softRejectText = text.toString();  
-    if (!softRejectText.isEmpty()) {
+    if (!softRejectText.isNull()) {
         DPRINT << "softRejectText:" << softRejectText;
         m_cpSettingsWrapper->writeSoftRejectText(softRejectText, true);
     }
@@ -363,24 +435,20 @@
         // Clicked first time, user want to check feature status
         DPRINT << "checking status";
         m_callWaitingWrapper->getCallWaitingStatus();
-    }
-
-    else if (callWaitingText == hbTrId("txt_phone_setlabel_call_waiting_val_on")) {
+    } else if (callWaitingText == hbTrId("txt_phone_setlabel_call_waiting_val_on")) {
         DPRINT << "activate";
         // User want to activate call waiting feature
         m_callWaitingWrapper->setCallWaiting(
             PSetCallWaitingWrapper::ActivateCallWaiting,
             AllTeleAndBearer);
-    }
-    else if (callWaitingText == hbTrId("txt_phone_setlabel_call_waiting_val_off")) {
+    } else if (callWaitingText == hbTrId("txt_phone_setlabel_call_waiting_val_off")) {
         DPRINT << "deactivate";
         // User want to deactivate call waiting feature
         m_callWaitingWrapper->setCallWaiting(
             PSetCallWaitingWrapper::DeactivateCallWaiting,
             AllTeleAndBearer);
-    }
-    else {
-        DPRINT << "nothing done";
+    } else {
+        DWARNING << ": Error, unhandled index!";
     }
 
     DPRINT << ": OUT";
@@ -404,18 +472,35 @@
 
     DPRINT << ": OUT";
 }
+
+/*!
+  CpCallsPluginGroup::ownVideoInReceivedCallStateChanged.
+ */
+void CpCallsPluginGroup::ownVideoInReceivedCallStateChanged(int index)
+{
+    DPRINT << ": IN : index: " << index;
     
+    if (index >= 0) {
+        //store to Cenrep
+        int ret = m_cpSettingsWrapper->writeVtVideoSending(index);
+        DPRINT << 
+            "m_cpSettingsWrapper->writeVtVideoSending(index) ret: " << ret;
+    }else{
+        DPRINT << "Error: negative index!";
+    }
+           
+    DPRINT << ": OUT";
+}
+
 /*!
   CpCallsPluginGroup::insertMappedListItems.
  */
 void CpCallsPluginGroup::insertMappedListItems()
 {
     DPRINT << ": IN";
-
     m_cliSettingMap.insert(ClirNetworkDefault, hbTrId("txt_phone_setlabel_val_default"));
     m_cliSettingMap.insert(ClirExplicitSuppress, hbTrId("txt_phone_setlabel_val_yes"));
     m_cliSettingMap.insert(ClirExplicitInvoke, hbTrId("txt_phone_setlabel_val_no"));
-
     DPRINT << ": OUT";
 }
 
@@ -428,7 +513,6 @@
 {
     DPRINT << ": IN status: " << status;
     // This happens only in the very first time when clicked.
-
     emit cancelNote(m_activeNoteId);
     
     bool alsCaseOnly = false;
@@ -441,9 +525,7 @@
     if (m_callWaitingDistinguishEnabled &&
             PSetCallWaitingWrapper::StatusNotProvisioned == status) {
         DPRINT << ": not provisioned";
-        emit showGlobalNote(m_activeNoteId,
-            hbTrId("txt_phone_info_request_not_completed"), 
-            HbMessageBox::MessageTypeInformation);
+        emit showNotificationDialog(hbTrId("txt_phone_info_request_not_completed"));
     } else if (PSetCallWaitingWrapper::StatusActive == status && !alsCaseOnly) {
         DPRINT << ": status active";
         m_DataItemCallWaiting->setContentWidgetData(
@@ -472,25 +554,17 @@
     DPRINT << ": IN";
     emit cancelNote(m_activeNoteId);
     if (result) {
-        emit showGlobalNote(m_activeNoteId,
-            hbTrId("txt_phone_info_request_not_confirmed"), 
-            HbMessageBox::MessageTypeWarning);
+        emit showNotificationDialog(hbTrId("txt_phone_info_request_not_confirmed"));
     } else {
         switch (command){
             case PSetCallWaitingWrapper::ActivateCallWaiting:
-                emit showGlobalNote(m_activeNoteId,
-                    hbTrId("txt_phone_info_call_waiting_activated"), 
-                    HbMessageBox::MessageTypeInformation);
+                emit showNotificationDialog(hbTrId("txt_phone_info_call_waiting_activated"));
                 break;
             case PSetCallWaitingWrapper::DeactivateCallWaiting:
-                emit showGlobalNote(m_activeNoteId,
-                    hbTrId("txt_phone_info_call_waiting_deactivated"), 
-                    HbMessageBox::MessageTypeInformation);
+                emit showNotificationDialog(hbTrId("txt_phone_info_call_waiting_deactivated"));
                 break;
             default: 
-                emit showGlobalNote(m_activeNoteId,
-                    hbTrId("txt_phone_info_result_unknown"), 
-                    HbMessageBox::MessageTypeInformation);
+                emit showNotificationDialog(hbTrId("txt_phone_info_result_unknown"));
                 break;
         }
     }
@@ -507,7 +581,7 @@
     Q_ASSERT(!(ongoing && interrupted));
     
     if (ongoing) {
-        emit showGlobalProgressNote(m_activeNoteId, hbTrId("txt_phone_info_requesting"));
+        emit showGlobalProgressNote(m_activeNoteId, hbTrId("txt_common_info_requesting"));
     }
     
     if (interrupted) {
@@ -524,9 +598,8 @@
 {
     DPRINT << ": IN";
     DPRINT << "errorCode:" << errorCode;
-    
+
     emit cancelNote(m_activeNoteId);
-    
     emit showGlobalErrorNote(m_activeNoteId, errorCode);
     
     DPRINT << ": OUT";