messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp
changeset 52 12db4185673b
parent 44 36f374c67aa8
--- a/messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp	Tue Jul 06 14:12:40 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp	Wed Aug 18 09:45:25 2010 +0300
@@ -27,7 +27,7 @@
 
 //Localized constants
 #define LOC_RECEIVING_SERVICE_MESSAGES hbTrId("txt_messaging_setlabel_receiving_service_messages")
-#define LOC_ON hbTrId("txt_messaging_setlabel_val_on")
+
 #define LOC_OFF hbTrId("txt_messaging_setlabel_val_off")
 #define LOC_REDUCED_SUPPORT hbTrId("txt_messaging_setlabel_val_reduced_support")
 #define LOC_FULL_SUPPORT hbTrId("txt_messaging_setlabel_val_full_support")
@@ -83,11 +83,7 @@
     MsgSettingEngine::CharacterEncoding charEncoding =
             MsgSettingEngine::ReducedSupport;
 
-    bool receiveServiceMessages = false;
-
-    mSettingEngine->settingsServiceMessagesAndCharEncoding(
-            receiveServiceMessages,
-            charEncoding);
+    mSettingEngine->settingsCharEncoding(charEncoding);
 
     // 1. Character encoding
     HbDataFormModelItem *characterEncoding =
@@ -109,29 +105,7 @@
                         this,
                         SLOT(changeCharEncoding(int)));
 
-    //2. receiving service messages
-    QStringList serviceMessagesList;
-    serviceMessagesList << LOC_OFF << LOC_ON;
-
-    index = int (receiveServiceMessages);
-    int otherIndex = (receiveServiceMessages + 1) % serviceMessagesList.count();
-
-    HbDataFormModelItem *serviceMessagesItem =
-            new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem,
-                                    LOC_RECEIVING_SERVICE_MESSAGES,
-                                    0);
-
-    serviceMessagesItem->setContentWidgetData("items", serviceMessagesList);
-    serviceMessagesItem->setContentWidgetData("currentIndex", index);
-
-    settingsModel->appendDataFormItem(serviceMessagesItem,
-                                      settingsModel->invisibleRootItem());
-    this->addConnection(serviceMessagesItem,
-                        SIGNAL(clicked()),
-                        this,
-                        SLOT(onPressedServiceMessages()));
-
-    // 3. MMS Settings
+    // 2. MMS Settings
     HbDataFormModelItem* mmsGroup =
             new HbDataFormModelItem(HbDataFormModelItem::GroupItem,
                                     LOC_MMS_SETTINGS,
@@ -157,15 +131,9 @@
     if (settingsView == MsgSettingsView::MMSView)
     {
         //set MMS Settings as expanded
-        QModelIndex index_mms = settingsModel->indexFromItem(mmsGroup);
-        //TODO: dataform issue on expanding one group item
-        //this->setExpanded(index_mms, true);
+        expandGroup(mmsGroup,true);
     }
-    else if(settingsView == MsgSettingsView::SMSView)
-    {
-        //expandSMSSettings();
-    }
-        
+    
 }
 
 void MsgSettingsForm::refreshViewForm()
@@ -227,6 +195,7 @@
                             this,
                             SLOT(onPressedCustomButton()));
     }    
+    
 }
 
 void MsgSettingsForm::addMMSGroupItem(HbDataFormModelItem* parent)
@@ -386,26 +355,6 @@
                         SLOT(onPressedCustomButton()));
 }
 
-void MsgSettingsForm::onPressedServiceMessages()
-{
-    HbPushButton *btn = qobject_cast<HbPushButton *> (sender());
-
-    if (btn)
-    {
-        QString btnText = btn->text();
-
-        //check if the button pressed was On or Off
-        if (LOC_OFF == btnText)
-        {
-            mSettingEngine->setReceiveSerivceMessages(false);
-        }
-        else
-        {
-            mSettingEngine->setReceiveSerivceMessages(true);
-        }
-    }
-}
-
 void MsgSettingsForm::changeCharEncoding(int index)
 {
     //set the character encoding
@@ -448,11 +397,11 @@
         //check if the button pressed was Yes or NO
         if (LOC_MMS_NO == btnText)
         {
-            mSettingEngine->setReceiveMMSAdverts(true);
+            mSettingEngine->setReceiveMMSAdverts(false);
         }
         else
         {
-            mSettingEngine->setReceiveMMSAdverts(false);
+            mSettingEngine->setReceiveMMSAdverts(true);
         }
     }
 }
@@ -489,10 +438,13 @@
     mSettingEngine->setSMSMessageCenter(index);
 }
 
-void MsgSettingsForm::expandSMSSettings()
+void MsgSettingsForm::expandGroup(HbDataFormModelItem* group,bool expand)
 {
-    QModelIndex index_sms = settingsModel->indexFromItem(mSmsMCGroup);
+    QModelIndex index = settingsModel->indexFromItem(group);
 
-    this->setExpanded(index_sms, true);
+    if(index.isValid())
+    {
+        this->setExpanded(index, expand);
+    }
 }
 //EOF