controlpanelui/src/cpplugins/personalizationplugin/src/cpprofilesettingform.cpp
changeset 19 36aa4756ee82
parent 12 624337f114fe
child 21 2883a5458389
equal deleted inserted replaced
12:624337f114fe 19:36aa4756ee82
    20 #include <QStringList>
    20 #include <QStringList>
    21 #include <hbdataformmodel.h>
    21 #include <hbdataformmodel.h>
    22 #include <hbabstractviewitem.h>
    22 #include <hbabstractviewitem.h>
    23 #include <cpitemdatahelper.h>
    23 #include <cpitemdatahelper.h>
    24 #include <cpprofilemodel.h>
    24 #include <cpprofilemodel.h>
       
    25 #include <hbslider.h>
    25 
    26 
    26 #include <QFileInfo>
    27 #include <QFileInfo>
    27 #include <QFileIconProvider>
    28 #include <QFileIconProvider>
    28 #include <QAbstractItemModel>
    29 #include <QAbstractItemModel>
    29 #include <QModelIndex>
    30 #include <QModelIndex>
    30 #include <QMap>
    31 #include <QMap>
    31 
    32 
       
    33 #include <xqsettingsmanager.h>
       
    34 #include <ProfileEngineInternalCRKeys.h>
       
    35 
    32 CpProfileSettingForm::CpProfileSettingForm()
    36 CpProfileSettingForm::CpProfileSettingForm()
    33     : mModel(0), mItemDataHelper(new CpItemDataHelper( this )),
    37     : mModel(0), mItemDataHelper(new CpItemDataHelper( this )),
    34     mProfileModel(new CpProfileModel()), mFileIconProvider(new QFileIconProvider),
    38     mProfileModel(new CpProfileModel()), mFileIconProvider(new QFileIconProvider),
    35     mGeneralPage(0),mMeetingPage(0),mCurrentPage( 0 )
    39     mGeneralPage(0),mMeetingPage(0),mCurrentPage( 0 ), mSettingManager(0)
    36 {
    40 {
    37     this->setHeading(hbTrId("txt_cp_button_advanced_settings"));
    41     this->setHeading(hbTrId("txt_cp_button_advanced_settings"));
    38     this->setDescription(hbTrId("txt_cp_info_select_tones_that_play_when_you_select"));
    42     this->setDescription(hbTrId("txt_cp_info_select_tones_that_play_when_you_select"));
    39     
    43     
    40     initModel();
    44     initModel();
    43 CpProfileSettingForm::~CpProfileSettingForm()
    47 CpProfileSettingForm::~CpProfileSettingForm()
    44 {
    48 {
    45     delete mModel;
    49     delete mModel;
    46     delete mProfileModel;
    50     delete mProfileModel;
    47     delete mFileIconProvider;
    51     delete mFileIconProvider;
       
    52     delete mSettingManager;
    48 }
    53 }
    49 
    54 
    50 void CpProfileSettingForm::initModel()
    55 void CpProfileSettingForm::initModel()
    51 {
    56 {
    52     mModel = new HbDataFormModel();
    57     mModel = new HbDataFormModel();
    60     if( meetingString.isEmpty() ) {
    65     if( meetingString.isEmpty() ) {
    61         qDebug( "warning: meeting profile name is empty");
    66         qDebug( "warning: meeting profile name is empty");
    62         meetingString = hbTrId("txt_cp_list_meeting"); 
    67         meetingString = hbTrId("txt_cp_list_meeting"); 
    63     }
    68     }
    64     
    69     
       
    70     mSettingManager = new XQSettingsManager();   
       
    71     
       
    72     XQCentralRepositorySettingsKey key(KCRUidProfileEngine.iUid,KProEngSilenceMode);
       
    73     
       
    74     QVariant silenceMode = mSettingManager->readItemValue(key,XQSettingsManager::TypeInt);
       
    75 
       
    76     mSettingManager->startMonitoring(key,XQSettingsManager::TypeInt);
       
    77     connect(mSettingManager, SIGNAL(valueChanged (XQSettingsKey, QVariant)),
       
    78             this, SLOT(settingValueChanged(XQSettingsKey, QVariant)));
       
    79     
    65     mGeneralPage = mModel->appendDataFormPage( generalString );
    80     mGeneralPage = mModel->appendDataFormPage( generalString );
    66     initGeneralTonesGroup();
    81     initProfileItems(EProfileWrapperGeneralId,mGeneralPage);
       
    82     
       
    83     //initGeneralTonesGroup();
       
    84     
    67     //initGeneralVibraGroup();
    85     //initGeneralVibraGroup();
    68     
    86     
    69     mMeetingPage = mModel->appendDataFormPage( meetingString );
    87     mMeetingPage = mModel->appendDataFormPage( meetingString );
    70     initMeetingTonesGroup();
    88     initProfileItems(EProfileWrapperMeetingId,mMeetingPage);
       
    89     //initMeetingTonesGroup();
    71     //initMeetingVibraGroup();
    90     //initMeetingVibraGroup();
    72 
       
    73     setModel(mModel);
    91     setModel(mModel);
    74 }
    92     settingValueChanged(key,silenceMode);
    75 
    93 }
       
    94 
       
    95 void CpProfileSettingForm::initProfileItems(int profileId,HbDataFormModelItem *parent)
       
    96 {
       
    97     CpProfileSettings profileSettings;
       
    98     mProfileModel->profileSettings( profileId, profileSettings );
       
    99     
       
   100     QHash<int,HbDataFormModelItem*> modelItems;
       
   101     
       
   102     //ring tone item
       
   103     QFileInfo ringToneFileInfo( profileSettings.mRingTone );
       
   104     HbDataFormModelItem *modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper,
       
   105             hbTrId("txt_cp_dblist_ringtone"), ringToneFileInfo.fileName(), mFileIconProvider->icon( ringToneFileInfo ),
       
   106             CpPersonalizationEntryItemData::TONE_Ring, profileId );
       
   107     mModel->appendDataFormItem(modelItem, parent);
       
   108     modelItems.insert(ProfileItemRingTone,modelItem);
       
   109     
       
   110     //message tone item
       
   111     QFileInfo messageToneFileInfo( profileSettings.mMessageTone );
       
   112     modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper,
       
   113             hbTrId("txt_cp_dblist_message_tone"), messageToneFileInfo.fileName(), mFileIconProvider->icon( messageToneFileInfo ),
       
   114             CpPersonalizationEntryItemData::TONE_Message,
       
   115             profileId );
       
   116     mModel->appendDataFormItem(modelItem , parent);
       
   117     modelItems.insert(ProfileItemMessageTone,modelItem);
       
   118     
       
   119     //email tone item
       
   120     QFileInfo emailToneFileInfo( profileSettings.mEmailTone );
       
   121     modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper,
       
   122             hbTrId("txt_cp_dblist_email_tone"),  emailToneFileInfo.fileName(), mFileIconProvider->icon( emailToneFileInfo ),
       
   123             CpPersonalizationEntryItemData::TONE_Email,
       
   124             profileId );
       
   125     mModel->appendDataFormItem(modelItem , parent);
       
   126     modelItems.insert(ProfileItemEmailTone,modelItem);
       
   127     
       
   128     //reminder tone item
       
   129     QFileInfo reminderToneFileInfo( profileSettings.mReminderTone );
       
   130     modelItem = new CpPersonalizationEntryItemData( *mItemDataHelper,
       
   131             hbTrId("txt_cp_dblist_reminder_tone"), reminderToneFileInfo.fileName(), mFileIconProvider->icon( reminderToneFileInfo ),
       
   132             CpPersonalizationEntryItemData::TONE_Reminder,
       
   133             profileId );
       
   134     mModel->appendDataFormItem(modelItem , parent);
       
   135     modelItems.insert(ProfileItemReminderTone,modelItem);
       
   136     
       
   137     //notification tones item
       
   138     modelItem= mModel->appendDataFormItem(HbDataFormModelItem::CheckBoxItem,QString(),parent);
       
   139     modelItem->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones"));
       
   140     modelItem->setContentWidgetData( "checkState", profileSettings.mNotificationTone ? 2 : 0 );
       
   141     if (profileId == EProfileWrapperGeneralId) {
       
   142         addConnection( modelItem, SIGNAL( stateChanged( int )), this, SLOT( on_general_notificationTones_stateChanged( int )));
       
   143     }
       
   144     else if (profileId == EProfileWrapperMeetingId) {
       
   145         addConnection( modelItem, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_notificationTones_stateChanged( int )));
       
   146     }
       
   147     modelItems.insert(ProfileItemNotificationTones,modelItem);
       
   148     
       
   149     
       
   150     //Key and Touch Screen Tones item
       
   151     modelItem = 
       
   152             mModel->appendDataFormItem(HbDataFormModelItem::SliderItem ,QString(hbTrId("txt_cp_setlabel_key_and_touchscreen_tones")),parent);
       
   153     
       
   154     QList<QVariant> sliderElements;
       
   155     sliderElements << QVariant(HbSlider::IncreaseElement) << QVariant(HbSlider::TrackElement)
       
   156             << QVariant(HbSlider::DecreaseElement) << QVariant(HbSlider::IconElement)
       
   157             << QVariant(HbSlider::TextElement);
       
   158     modelItem->setContentWidgetData("sliderElements",sliderElements);
       
   159     
       
   160     
       
   161     
       
   162     //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
       
   163     modelItem->setContentWidgetData( QString( "minimum" ), 0 );
       
   164     modelItem->setContentWidgetData( QString( "maximum" ), 5 );
       
   165     modelItem->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenTone );
       
   166     QMap< QString, QVariant > elements;
       
   167     elements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg"));
       
   168     elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") );
       
   169     if (profileSettings.mKeyTouchScreenTone != 0) {
       
   170         elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg") );
       
   171     }
       
   172     else {
       
   173         elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") );
       
   174     }
       
   175     
       
   176     modelItem->setContentWidgetData( QString( "elementIcons" ), elements );
       
   177     
       
   178     if (profileId == EProfileWrapperGeneralId) {
       
   179         addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_general_keysAndScreenToneSlider_ValueChanged( int )));
       
   180     }
       
   181     else if (profileId == EProfileWrapperMeetingId) {
       
   182         addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_keysAndScreenToneSlider_ValueChanged( int )));
       
   183     }
       
   184   
       
   185     modelItems.insert(ProfileItemKeyandTouchScreenTones,modelItem);
       
   186     
       
   187     
       
   188     //Touch Screen Vibra item
       
   189     modelItem = mModel->appendDataFormItem( HbDataFormModelItem::SliderItem, QString( hbTrId( "txt_cp_setlabel_touch_screen_vibra" ) ), parent );
       
   190      //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
       
   191     modelItem->setContentWidgetData( QString( "minimum" ), 0 );
       
   192     modelItem->setContentWidgetData( QString( "maximum" ), 5 );
       
   193     modelItem->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenVibra );
       
   194     
       
   195     if (profileId == EProfileWrapperGeneralId) {
       
   196         addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_general_screenVibra_ValueChanged( int )));
       
   197     }
       
   198     else if (profileId == EProfileWrapperMeetingId) {
       
   199         addConnection( modelItem, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_screenVibra_ValueChanged( int )));
       
   200     }
       
   201     
       
   202     modelItems.insert(ProfileItemTouchScreenVibra,modelItem);
       
   203     
       
   204     mProfileModelItems.insert(profileId,modelItems);
       
   205     
       
   206 }
       
   207 
       
   208 /*
    76 void CpProfileSettingForm::initGeneralTonesGroup()
   209 void CpProfileSettingForm::initGeneralTonesGroup()
    77 {
   210 {
    78     CpProfileSettings profileSettings;
   211     CpProfileSettings profileSettings;
    79     mProfileModel->profileSettings( EProfileWrapperGeneralId, profileSettings );
   212     mProfileModel->profileSettings( EProfileWrapperGeneralId, profileSettings );
    80     
   213     
    81     /*HbDataFormModelItem *tonesGroup = mModel->appendDataFormGroup(
   214     //HbDataFormModelItem *tonesGroup = mModel->appendDataFormGroup(
    82         hbTrId("txt_cp_subhead_tones"),mGeneralPage);*/
   215      //   hbTrId("txt_cp_subhead_tones"),mGeneralPage);
    83     QFileInfo ringToneFileInfo( profileSettings.mRingTone );
   216     QFileInfo ringToneFileInfo( profileSettings.mRingTone );
    84     mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper,
   217     mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper,
    85         hbTrId("txt_cp_dblist_ringtone"), ringToneFileInfo.fileName(), mFileIconProvider->icon( ringToneFileInfo ) ), mGeneralPage);
   218         hbTrId("txt_cp_dblist_ringtone"), ringToneFileInfo.fileName(), mFileIconProvider->icon( ringToneFileInfo ) ), mGeneralPage);
    86     
   219     
    87     QFileInfo messageToneFileInfo( profileSettings.mMessageTone );
   220     QFileInfo messageToneFileInfo( profileSettings.mMessageTone );
   100     notificationTones->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones"));
   233     notificationTones->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones"));
   101     notificationTones->setContentWidgetData( "checkState", profileSettings.mNotificationTone?2:0 );
   234     notificationTones->setContentWidgetData( "checkState", profileSettings.mNotificationTone?2:0 );
   102     
   235     
   103     mGeneralKeysAndScreenToneSlider = 
   236     mGeneralKeysAndScreenToneSlider = 
   104             mModel->appendDataFormItem(HbDataFormModelItem::SliderItem ,QString(hbTrId("txt_cp_setlabel_key_and_touchscreen_tones")),mGeneralPage);
   237             mModel->appendDataFormItem(HbDataFormModelItem::SliderItem ,QString(hbTrId("txt_cp_setlabel_key_and_touchscreen_tones")),mGeneralPage);
   105     /*
   238     
   106     QMap< QString, QVariant > elements;
   239     //QMap< QString, QVariant > elements;
   107     elements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg"));
   240     //elements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg"));
   108     elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") );
   241     //elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") );
   109     elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") );
   242     //elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") );
   110     mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString( "elementIcons" ), elements );
   243     //mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString( "elementIcons" ), elements );
   111      */
   244      
   112     //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
   245     //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
   113     mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString( "minimum" ), 0 );
   246     mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString( "minimum" ), 0 );
   114     mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString( "maximum" ), 5 );
   247     mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString( "maximum" ), 5 );
   115     mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenTone );
   248     mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenTone );
   116     
   249     
   123     
   256     
   124     addConnection( notificationTones, SIGNAL( stateChanged( int )), this, SLOT( on_general_notificationTones_stateChanged( int )));
   257     addConnection( notificationTones, SIGNAL( stateChanged( int )), this, SLOT( on_general_notificationTones_stateChanged( int )));
   125     addConnection( mGeneralKeysAndScreenToneSlider, SIGNAL( valueChanged( int )), this, SLOT( on_general_keysAndScreenToneSlider_ValueChanged( int )));
   258     addConnection( mGeneralKeysAndScreenToneSlider, SIGNAL( valueChanged( int )), this, SLOT( on_general_keysAndScreenToneSlider_ValueChanged( int )));
   126     addConnection( mGeneralSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_general_screenVibra_ValueChanged( int )));    
   259     addConnection( mGeneralSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_general_screenVibra_ValueChanged( int )));    
   127 }
   260 }
       
   261 */
   128 
   262 
   129 /*void CpProfileSettingForm::initGeneralVibraGroup()
   263 /*void CpProfileSettingForm::initGeneralVibraGroup()
   130 {
   264 {
   131     CpProfileSettings profileSettings;
   265     CpProfileSettings profileSettings;
   132     mProfileModel->profileSettings( EProfileWrapperGeneralId, profileSettings );
   266     mProfileModel->profileSettings( EProfileWrapperGeneralId, profileSettings );
   167     
   301     
   168     addConnection( mGeneralSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_general_screenVibra_ValueChanged( int )));
   302     addConnection( mGeneralSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_general_screenVibra_ValueChanged( int )));
   169 }*/
   303 }*/
   170 
   304 
   171 ////////////////////////////////////////////////////////////
   305 ////////////////////////////////////////////////////////////
   172 void CpProfileSettingForm::initMeetingTonesGroup()
   306 /*void CpProfileSettingForm::initMeetingTonesGroup()
   173 {
   307 {
   174     CpProfileSettings profileSettings;
   308     CpProfileSettings profileSettings;
   175     mProfileModel->profileSettings( EProfileWrapperMeetingId, profileSettings );
   309     mProfileModel->profileSettings( EProfileWrapperMeetingId, profileSettings );
   176     
   310     
   177    /* HbDataFormModelItem *tonesGroup = mModel->appendDataFormGroup(
   311    //HbDataFormModelItem *tonesGroup = mModel->appendDataFormGroup(
   178         hbTrId("txt_cp_subhead_tones"),mMeetingPage);*/
   312    //     hbTrId("txt_cp_subhead_tones"),mMeetingPage);
   179     QFileInfo ringToneFileInfo( profileSettings.mRingTone );
   313     QFileInfo ringToneFileInfo( profileSettings.mRingTone );
   180     mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper,
   314     mModel->appendDataFormItem( new CpPersonalizationEntryItemData( *mItemDataHelper,
   181         hbTrId("txt_cp_dblist_ringtone"), ringToneFileInfo.fileName(), mFileIconProvider->icon( ringToneFileInfo ) ), mMeetingPage);
   315         hbTrId("txt_cp_dblist_ringtone"), ringToneFileInfo.fileName(), mFileIconProvider->icon( ringToneFileInfo ) ), mMeetingPage);
   182     
   316     
   183     QFileInfo messageToneFileInfo( profileSettings.mMessageTone );
   317     QFileInfo messageToneFileInfo( profileSettings.mMessageTone );
   196     notificationTones->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones"));
   330     notificationTones->setContentWidgetData("text", hbTrId("txt_cp_list_notification_tones"));
   197     notificationTones->setContentWidgetData( "checkState", profileSettings.mNotificationTone?2:0 );
   331     notificationTones->setContentWidgetData( "checkState", profileSettings.mNotificationTone?2:0 );
   198     
   332     
   199     mMeetingKeysAndScreenToneSlider = 
   333     mMeetingKeysAndScreenToneSlider = 
   200             mModel->appendDataFormItem(HbDataFormModelItem::SliderItem ,QString(hbTrId("txt_cp_setlabel_key_and_touchscreen_tones")),mMeetingPage);
   334             mModel->appendDataFormItem(HbDataFormModelItem::SliderItem ,QString(hbTrId("txt_cp_setlabel_key_and_touchscreen_tones")),mMeetingPage);
   201     /*
   335     
   202     QMap< QString, QVariant > elements;
   336     //QMap< QString, QVariant > elements;
   203     elements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg"));
   337     //elements.insert(QString("IncreaseElement") , QVariant(":/icon/hb_vol_slider_increment.svg"));
   204     elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") );
   338     //elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg") );
   205     elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") );
   339     //elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") );
   206     mMeetingkeysAndScreenSlider->setContentWidgetData( QString( "elementIcons" ), elements );
   340     //mMeetingkeysAndScreenSlider->setContentWidgetData( QString( "elementIcons" ), elements );
   207     */
   341     
   208     //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
   342     //TODO: profileModel need provide Max and Min value( 0-5 ), current max value from profileModel is 3
   209     mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString( "minimum" ), 0 );
   343     mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString( "minimum" ), 0 );
   210     mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString( "maximum" ), 5 );
   344     mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString( "maximum" ), 5 );
   211     mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenTone );
   345     mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString("value"), profileSettings.mKeyTouchScreenTone );
   212     
   346     
   218     
   352     
   219     addConnection( notificationTones, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_notificationTones_stateChanged( int )));
   353     addConnection( notificationTones, SIGNAL( stateChanged( int )), this, SLOT( on_meeting_notificationTones_stateChanged( int )));
   220     addConnection( mMeetingKeysAndScreenToneSlider, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_keysAndScreenSlider_ValueChanged( int )));
   354     addConnection( mMeetingKeysAndScreenToneSlider, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_keysAndScreenSlider_ValueChanged( int )));
   221     addConnection( mMeetingSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_screenVibra_ValueChanged( int )));
   355     addConnection( mMeetingSreenVibra, SIGNAL( valueChanged( int )), this, SLOT( on_meeting_screenVibra_ValueChanged( int )));
   222 }
   356 }
   223 
   357 */
   224 /*void CpProfileSettingForm::initMeetingVibraGroup()
   358 /*void CpProfileSettingForm::initMeetingVibraGroup()
   225 {
   359 {
   226     CpProfileSettings profileSettings;
   360     CpProfileSettings profileSettings;
   227     mProfileModel->profileSettings( EProfileWrapperMeetingId, profileSettings );
   361     mProfileModel->profileSettings( EProfileWrapperMeetingId, profileSettings );
   228         
   362         
   271 }
   405 }
   272 
   406 
   273 void CpProfileSettingForm::on_general_keysAndScreenToneSlider_ValueChanged( int value )
   407 void CpProfileSettingForm::on_general_keysAndScreenToneSlider_ValueChanged( int value )
   274 {
   408 {
   275     mProfileModel->setKeyTouchScreenTone( EProfileWrapperGeneralId, value );
   409     mProfileModel->setKeyTouchScreenTone( EProfileWrapperGeneralId, value );
   276     mGeneralKeysAndScreenToneSlider->setContentWidgetData( QString("value"), value );
   410     HbDataFormModelItem *modelItem = profileItem(EProfileWrapperGeneralId,ProfileItemKeyandTouchScreenTones);
       
   411     if (modelItem) {
       
   412         modelItem->setContentWidgetData( QString("value"), value );
       
   413         QMap< QString, QVariant > elements;
       
   414         if (value != 0) {      
       
   415             elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg"));
       
   416             elements.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg"));
       
   417             elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg") );            
       
   418         }
       
   419         else {
       
   420             elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg"));
       
   421             elements.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg"));
       
   422             elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") );  
       
   423         }
       
   424         modelItem->setContentWidgetData( QString( "elementIcons" ), elements );            
       
   425     }
   277 }
   426 }
   278 
   427 
   279 
   428 
   280 //general vibra
   429 //general vibra
   281 void CpProfileSettingForm::on_general_ringVibar_stateChanged( int state )
   430 void CpProfileSettingForm::on_general_ringVibar_stateChanged( int state )
   299     mProfileModel->setNotificationVibra( EProfileWrapperGeneralId, checkBoxStateToBool( state ) );
   448     mProfileModel->setNotificationVibra( EProfileWrapperGeneralId, checkBoxStateToBool( state ) );
   300 }
   449 }
   301 void CpProfileSettingForm::on_general_screenVibra_ValueChanged( int value )
   450 void CpProfileSettingForm::on_general_screenVibra_ValueChanged( int value )
   302 {
   451 {
   303     mProfileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, value );
   452     mProfileModel->setKeyTouchScreenVibra( EProfileWrapperGeneralId, value );
   304     mGeneralSreenVibra->setContentWidgetData( QString("value"), value );
   453     
       
   454     HbDataFormModelItem *modelItem = profileItem(EProfileWrapperGeneralId,ProfileItemTouchScreenVibra);
       
   455     if (modelItem) {
       
   456         modelItem->setContentWidgetData( QString("value"), value );
       
   457     }
   305 
   458 
   306 }
   459 }
   307 
   460 
   308 ////////////////////////////////////////////////////
   461 ////////////////////////////////////////////////////
   309 //meeting Tones
   462 //meeting Tones
   310 void CpProfileSettingForm::on_meeting_notificationTones_stateChanged(int state)
   463 void CpProfileSettingForm::on_meeting_notificationTones_stateChanged(int state)
   311 {
   464 {
   312     mProfileModel->setNotificationTone( EProfileWrapperMeetingId, checkBoxStateToBool( state ) );
   465     mProfileModel->setNotificationTone( EProfileWrapperMeetingId, checkBoxStateToBool( state ) );
   313 }
   466 }
   314 
   467 
   315 void CpProfileSettingForm::on_meeting_keysAndScreenSlider_ValueChanged( int value )
   468 void CpProfileSettingForm::on_meeting_keysAndScreenToneSlider_ValueChanged( int value )
   316 {
   469 {
   317     mProfileModel->setKeyTouchScreenTone( EProfileWrapperMeetingId, value );
   470     mProfileModel->setKeyTouchScreenTone( EProfileWrapperMeetingId, value );
   318     mMeetingKeysAndScreenToneSlider->setContentWidgetData( QString("value"), value );
   471     
       
   472     HbDataFormModelItem *modelItem = profileItem(EProfileWrapperMeetingId,ProfileItemKeyandTouchScreenTones);
       
   473     if (modelItem) {
       
   474         modelItem->setContentWidgetData( QString("value"), value );
       
   475         QMap< QString, QVariant > elements;
       
   476         if (value != 0) {
       
   477             elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg"));
       
   478             elements.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg"));
       
   479             elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_unmuted.svg") );            
       
   480         }
       
   481         else {
       
   482             elements.insert(QString("DecreaseElement"), QVariant(":/icon/hb_vol_slider_decrement.svg"));
       
   483             elements.insert(QString("IncreaseElement"), QVariant(":/icon/hb_vol_slider_increment.svg"));
       
   484             elements.insert(QString("IconElement"), QVariant(":/icon/hb_vol_slider_muted.svg") );  
       
   485         }
       
   486         modelItem->setContentWidgetData( QString( "elementIcons" ), elements );            
       
   487     }
   319 }
   488 }
   320 
   489 
   321 
   490 
   322 //meeting vibra
   491 //meeting vibra
   323 void CpProfileSettingForm::on_meeting_ringVibar_stateChanged( int state )
   492 void CpProfileSettingForm::on_meeting_ringVibar_stateChanged( int state )
   341     mProfileModel->setNotificationVibra( EProfileWrapperMeetingId, checkBoxStateToBool( state ) );
   510     mProfileModel->setNotificationVibra( EProfileWrapperMeetingId, checkBoxStateToBool( state ) );
   342 }
   511 }
   343 void CpProfileSettingForm::on_meeting_screenVibra_ValueChanged( int value )
   512 void CpProfileSettingForm::on_meeting_screenVibra_ValueChanged( int value )
   344 {
   513 {
   345     mProfileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, value );
   514     mProfileModel->setKeyTouchScreenVibra( EProfileWrapperMeetingId, value );
   346     mMeetingSreenVibra->setContentWidgetData( QString("value"), value );
   515     
       
   516     HbDataFormModelItem *modelItem = profileItem(EProfileWrapperMeetingId,ProfileItemTouchScreenVibra);
       
   517     if (modelItem) {
       
   518         modelItem->setContentWidgetData( QString("value"), value );
       
   519     }
   347 }
   520 }
   348 
   521 
   349 bool CpProfileSettingForm::checkBoxStateToBool( int state )
   522 bool CpProfileSettingForm::checkBoxStateToBool( int state )
   350 {
   523 {
   351     if( state == Qt::Checked ) {
   524     if( state == Qt::Checked ) {
   352         return true;
   525         return true;
   353     } else {
   526     } else {
   354         return false;
   527         return false;
   355     }
   528     }
   356 }
   529 }
       
   530 
       
   531 
       
   532 void CpProfileSettingForm::settingValueChanged(const XQSettingsKey &key, const QVariant &value)
       
   533 {
       
   534     if (key.uid() == KCRUidProfileEngine.iUid && key.key() == KProEngSilenceMode && value.isValid()) {
       
   535     
       
   536 		static const int silenceSensitiveModelItemIds[] = 
       
   537 		{       
       
   538 			CpProfileSettingForm::ProfileItemRingTone,
       
   539 			CpProfileSettingForm::ProfileItemMessageTone,
       
   540 			CpProfileSettingForm::ProfileItemEmailTone,
       
   541 			CpProfileSettingForm::ProfileItemReminderTone,
       
   542 			CpProfileSettingForm::ProfileItemNotificationTones,
       
   543 			CpProfileSettingForm::ProfileItemKeyandTouchScreenTones
       
   544 		};
       
   545     
       
   546         QHash< int,QHash<int,HbDataFormModelItem*>  >::const_iterator it (mProfileModelItems.begin());
       
   547         for(; it != mProfileModelItems.end(); ++it ) {          
       
   548             for (int i = 0; i < sizeof(silenceSensitiveModelItemIds)/sizeof(silenceSensitiveModelItemIds[0]);++i) {           
       
   549                 QHash<int,HbDataFormModelItem*>::const_iterator found = it.value().find(silenceSensitiveModelItemIds[i]);
       
   550                 if (found != it.value().end()) {
       
   551                     found.value()->setEnabled(!value.toBool());
       
   552                 }
       
   553             }   
       
   554         }
       
   555     }
       
   556 }
       
   557 
       
   558 HbDataFormModelItem *CpProfileSettingForm::profileItem(int profileId,int profileItemId)
       
   559 {
       
   560     return mProfileModelItems.value(profileId).value(profileItemId);
       
   561 }
       
   562 
       
   563 //End of File