diff -r 5de72ea7a065 -r 579cc610882e clock/clockui/clocksettingsview/src/clocksettingsview.cpp --- a/clock/clockui/clocksettingsview/src/clocksettingsview.cpp Wed Jun 23 18:11:28 2010 +0300 +++ b/clock/clockui/clocksettingsview/src/clocksettingsview.cpp Tue Jul 06 14:14:56 2010 +0300 @@ -25,8 +25,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -55,16 +54,10 @@ ClockSettingsView::ClockSettingsView(QObject *parent) :QObject(parent) { - qDebug("clock: ClockSettingsView::ClockSettingsView() -->"); // Load the translation file and install the editor specific translator - mTranslator = new QTranslator; - //QString lang = QLocale::system().name(); - //QString path = "Z:/resource/qt/translations/"; - mTranslator->load("clocksettingsview",":/translations"); - // TODO: Load the appropriate .qm file based on locale - //bool loaded = mTranslator->load("caleneditor_" + lang, path); - HbApplication::instance()->installTranslator(mTranslator); + mTranslator = new HbTranslator("clocksettingsview"); + mTranslator->loadCommon(); // Construct the settings utility. mSettingsUtility = new SettingsUtility(); @@ -121,7 +114,6 @@ } // Remove the translator - HbApplication::instance()->removeTranslator(mTranslator); if (mTranslator) { delete mTranslator; mTranslator = 0; @@ -130,9 +122,6 @@ delete mSettingsUtility; } - if (!mTimezoneClient->isNull()) { - mTimezoneClient->deleteInstance(); - } if(mSettingsModel){ delete mSettingsModel; } @@ -296,7 +285,7 @@ // Create the custom prototype. QList prototypes = mSettingsForm->itemPrototypes(); - SettingsCustomItem *customPrototype = new SettingsCustomItem(); + SettingsCustomItem *customPrototype = new SettingsCustomItem(mSettingsForm); prototypes.append(customPrototype); mSettingsForm->setItemPrototypes(prototypes); @@ -399,8 +388,28 @@ static_cast (HbDataFormModelItem::CustomItemBase + RegionalSettingsItem); mSettingsModel->appendDataFormItem(regionalSettingsItem); - - // Add the alarm snooze time item. + + // Add the clock type item. + HbDataFormModelItem::DataItemType clockTypeSettingsItem = + static_cast + (HbDataFormModelItem::ToggleValueItem); + mClockTypeItem = mSettingsModel->appendDataFormItem( + clockTypeSettingsItem,hbTrId("txt_clock_setlabel_clock_type")); + QStringList clockTypeList; + int clockType = mSettingsUtility->clockType(clockTypeList); + int zeroIndex(0); + if( zeroIndex == clockType ){ + mClockTypeItem->setContentWidgetData("text", clockTypeList[0]); + mClockTypeItem->setContentWidgetData("additionalText", clockTypeList[1]); + } else { + mClockTypeItem->setContentWidgetData("text", clockTypeList[1]); + mClockTypeItem->setContentWidgetData("additionalText", clockTypeList[0]); + } + mSettingsForm->addConnection( + mClockTypeItem, SIGNAL(clicked()), + this, SLOT(handleClockTypeChanged())); + + // Add the alarm snooze time item. mAlarmSnoozeItem = mSettingsModel->appendDataFormItem( HbDataFormModelItem::ComboBoxItem, hbTrId("txt_clock_setlabel_alarm_snooze_time")); @@ -490,6 +499,15 @@ } /*! + Slot which handles the clock type change.. + */ +void ClockSettingsView::handleClockTypeChanged() +{ + mSettingsUtility->setClockType( + mClockTypeItem->contentWidgetData("text").toString()); +} + +/*! Slot which is called when the value changes in cenrep. \param key The key which got changed in cenrep.