diff -r b0711afde476 -r fa7c359294fa clock/clockui/clockviews/src/clockmainview.cpp --- a/clock/clockui/clockviews/src/clockmainview.cpp Fri Sep 17 08:29:05 2010 +0300 +++ b/clock/clockui/clockviews/src/clockmainview.cpp Mon Oct 04 00:15:49 2010 +0300 @@ -29,6 +29,9 @@ #include #include // hbapplication #include // activity manager +#include +#include +#include // User includes #include "clockmainview.h" @@ -86,6 +89,12 @@ delete mAlarmListModel; mAlarmListModel = 0; } + if (mSettingsManager) { + delete mSettingsManager; + } + // Delete cenrep key + delete mClockTypeSettingsKey; + HbStyleLoader::unregisterFilePath( ":/style/clockalarmlistitemprototype.css"); HbStyleLoader::unregisterFilePath( @@ -280,6 +289,16 @@ mTimezoneClient, SIGNAL(cityUpdated()), this, SLOT(updatePlaceLabel())); + // Connect for the clock type changes to refresh the view + mSettingsManager = new XQSettingsManager(this); + mClockTypeSettingsKey = new XQSettingsKey( + XQSettingsKey::TargetCentralRepository, + KCRUidClockApp, + KClockType); + mSettingsManager->startMonitoring(*mClockTypeSettingsKey); + connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)), + this, SLOT(eventMonitor(XQSettingsKey, QVariant))); + OstTraceFunctionExit0( CLOCKMAINVIEW_SETUPAFTERVIEWREADY_EXIT ); } @@ -496,6 +515,24 @@ OstTraceFunctionExit0( CLOCKMAINVIEW_REMOVESNOOZEDALARM_EXIT ); } +/*! + Slot which is called when the value changes in cenrep. + + \param key The key which got changed in cenrep. + \param value The new value of that key. + */ +void ClockMainView::eventMonitor( + const XQSettingsKey& key, const QVariant& value) +{ + OstTraceFunctionEntry0( CLOCKMAINVIEW_EVENTMONITOR_ENTRY ); + if (key.uid() == KCRUidClockApp && key.key() == KClockType) { + // Update view + updateView(); + } + OstTraceFunctionExit0( CLOCKMAINVIEW_EVENTMONITOR_EXIT ); +} + + void ClockMainView::updateView() { OstTraceFunctionEntry0( CLOCKMAINVIEW_UPDATEVIEW_ENTRY ); @@ -761,9 +798,9 @@ int index = mSettingsUtility->clockType(clockType); int zeroIndex(0); if(zeroIndex == index){ - mClockWidget->setClockType(ClockWidget::ClockTypeDigital); + mClockWidget->setClockType(ClockWidget::ClockTypeAnalog); } else { - mClockWidget->setClockType(ClockWidget::ClockTypeAnalog); + mClockWidget->setClockType(ClockWidget::ClockTypeDigital); } QStringList timeFormat;