messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp
changeset 48 4f501b74aeb1
parent 46 b1f0785c289d
equal deleted inserted replaced
46:b1f0785c289d 48:4f501b74aeb1
    25 
    25 
    26 #include "debugtraces.h"
    26 #include "debugtraces.h"
    27 
    27 
    28 //Localized constants
    28 //Localized constants
    29 #define LOC_RECEIVING_SERVICE_MESSAGES hbTrId("txt_messaging_setlabel_receiving_service_messages")
    29 #define LOC_RECEIVING_SERVICE_MESSAGES hbTrId("txt_messaging_setlabel_receiving_service_messages")
    30 #define LOC_ON hbTrId("txt_messaging_setlabel_val_on")
    30 
    31 #define LOC_OFF hbTrId("txt_messaging_setlabel_val_off")
    31 #define LOC_OFF hbTrId("txt_messaging_setlabel_val_off")
    32 #define LOC_REDUCED_SUPPORT hbTrId("txt_messaging_setlabel_val_reduced_support")
    32 #define LOC_REDUCED_SUPPORT hbTrId("txt_messaging_setlabel_val_reduced_support")
    33 #define LOC_FULL_SUPPORT hbTrId("txt_messaging_setlabel_val_full_support")
    33 #define LOC_FULL_SUPPORT hbTrId("txt_messaging_setlabel_val_full_support")
    34 #define LOC_ADVANCED hbTrId("txt_messaging_button_advanced")
    34 #define LOC_ADVANCED hbTrId("txt_messaging_button_advanced")
    35 #define LOC_CHAR_ENCODING hbTrId("txt_messaging_setlabel_character_encoding")
    35 #define LOC_CHAR_ENCODING hbTrId("txt_messaging_setlabel_character_encoding")
    81     settingsModel = new HbDataFormModel(0);
    81     settingsModel = new HbDataFormModel(0);
    82 
    82 
    83     MsgSettingEngine::CharacterEncoding charEncoding =
    83     MsgSettingEngine::CharacterEncoding charEncoding =
    84             MsgSettingEngine::ReducedSupport;
    84             MsgSettingEngine::ReducedSupport;
    85 
    85 
    86     bool receiveServiceMessages = false;
    86     mSettingEngine->settingsCharEncoding(charEncoding);
    87 
       
    88     mSettingEngine->settingsServiceMessagesAndCharEncoding(
       
    89             receiveServiceMessages,
       
    90             charEncoding);
       
    91 
    87 
    92     // 1. Character encoding
    88     // 1. Character encoding
    93     HbDataFormModelItem *characterEncoding =
    89     HbDataFormModelItem *characterEncoding =
    94             new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem,
    90             new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem,
    95                                     LOC_CHAR_ENCODING,
    91                                     LOC_CHAR_ENCODING,
   107     this->addConnection(characterEncoding,
   103     this->addConnection(characterEncoding,
   108                         SIGNAL(currentIndexChanged(int)),
   104                         SIGNAL(currentIndexChanged(int)),
   109                         this,
   105                         this,
   110                         SLOT(changeCharEncoding(int)));
   106                         SLOT(changeCharEncoding(int)));
   111 
   107 
   112     //2. receiving service messages
   108     // 2. MMS Settings
   113     QStringList serviceMessagesList;
       
   114     serviceMessagesList << LOC_OFF << LOC_ON;
       
   115 
       
   116     index = int (receiveServiceMessages);
       
   117     int otherIndex = (receiveServiceMessages + 1) % serviceMessagesList.count();
       
   118 
       
   119     HbDataFormModelItem *serviceMessagesItem =
       
   120             new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem,
       
   121                                     LOC_RECEIVING_SERVICE_MESSAGES,
       
   122                                     0);
       
   123 
       
   124     serviceMessagesItem->setContentWidgetData("items", serviceMessagesList);
       
   125     serviceMessagesItem->setContentWidgetData("currentIndex", index);
       
   126 
       
   127     settingsModel->appendDataFormItem(serviceMessagesItem,
       
   128                                       settingsModel->invisibleRootItem());
       
   129     this->addConnection(serviceMessagesItem,
       
   130                         SIGNAL(clicked()),
       
   131                         this,
       
   132                         SLOT(onPressedServiceMessages()));
       
   133 
       
   134     // 3. MMS Settings
       
   135     HbDataFormModelItem* mmsGroup =
   109     HbDataFormModelItem* mmsGroup =
   136             new HbDataFormModelItem(HbDataFormModelItem::GroupItem,
   110             new HbDataFormModelItem(HbDataFormModelItem::GroupItem,
   137                                     LOC_MMS_SETTINGS,
   111                                     LOC_MMS_SETTINGS,
   138                                     0);
   112                                     0);
   139 
   113 
   379                         SIGNAL(clicked()),
   353                         SIGNAL(clicked()),
   380                         this,
   354                         this,
   381                         SLOT(onPressedCustomButton()));
   355                         SLOT(onPressedCustomButton()));
   382 }
   356 }
   383 
   357 
   384 void MsgSettingsForm::onPressedServiceMessages()
       
   385 {
       
   386     HbPushButton *btn = qobject_cast<HbPushButton *> (sender());
       
   387 
       
   388     if (btn)
       
   389     {
       
   390         QString btnText = btn->text();
       
   391 
       
   392         //check if the button pressed was On or Off
       
   393         if (LOC_OFF == btnText)
       
   394         {
       
   395             mSettingEngine->setReceiveSerivceMessages(false);
       
   396         }
       
   397         else
       
   398         {
       
   399             mSettingEngine->setReceiveSerivceMessages(true);
       
   400         }
       
   401     }
       
   402 }
       
   403 
       
   404 void MsgSettingsForm::changeCharEncoding(int index)
   358 void MsgSettingsForm::changeCharEncoding(int index)
   405 {
   359 {
   406     //set the character encoding
   360     //set the character encoding
   407     mSettingEngine->setCharacterEncoding(MsgSettingEngine::CharacterEncoding(index));
   361     mSettingEngine->setCharacterEncoding(MsgSettingEngine::CharacterEncoding(index));
   408 }
   362 }
   441         QString btnText = btn->text();
   395         QString btnText = btn->text();
   442 
   396 
   443         //check if the button pressed was Yes or NO
   397         //check if the button pressed was Yes or NO
   444         if (LOC_MMS_NO == btnText)
   398         if (LOC_MMS_NO == btnText)
   445         {
   399         {
       
   400             mSettingEngine->setReceiveMMSAdverts(false);
       
   401         }
       
   402         else
       
   403         {
   446             mSettingEngine->setReceiveMMSAdverts(true);
   404             mSettingEngine->setReceiveMMSAdverts(true);
   447         }
       
   448         else
       
   449         {
       
   450             mSettingEngine->setReceiveMMSAdverts(false);
       
   451         }
   405         }
   452     }
   406     }
   453 }
   407 }
   454 
   408 
   455 void MsgSettingsForm::changeAccessPoint(int index)
   409 void MsgSettingsForm::changeAccessPoint(int index)