clock/clockui/clockviews/src/clockmainview.cpp
changeset 75 7ac58b2aae6f
parent 70 a5ed90760192
child 81 ce92091cbd61
equal deleted inserted replaced
72:27feeedec790 75:7ac58b2aae6f
    27 #include <HbNotificationDialog>
    27 #include <HbNotificationDialog>
    28 #include <HbStyleLoader>
    28 #include <HbStyleLoader>
    29 #include <HbColorScheme>
    29 #include <HbColorScheme>
    30 #include <HbApplication> // hbapplication
    30 #include <HbApplication> // hbapplication
    31 #include <HbActivityManager> // activity manager
    31 #include <HbActivityManager> // activity manager
       
    32 #include <xqsettingsmanager.h>
       
    33 #include <xqsettingskey.h>
       
    34 #include <clockdomaincrkeys.h>
    32 
    35 
    33 // User includes
    36 // User includes
    34 #include "clockmainview.h"
    37 #include "clockmainview.h"
    35 #include "clockdocloader.h"
    38 #include "clockdocloader.h"
    36 #include "clockappcontrollerif.h"
    39 #include "clockappcontrollerif.h"
    84 	}
    87 	}
    85 	if (mAlarmListModel) {
    88 	if (mAlarmListModel) {
    86 		delete mAlarmListModel;
    89 		delete mAlarmListModel;
    87 		mAlarmListModel = 0;
    90 		mAlarmListModel = 0;
    88 	}
    91 	}
       
    92 	if (mSettingsManager) {
       
    93 		delete mSettingsManager;
       
    94 	}
       
    95 	// Delete cenrep key
       
    96 	delete mClockTypeSettingsKey;
       
    97 	
    89 	HbStyleLoader::unregisterFilePath(
    98 	HbStyleLoader::unregisterFilePath(
    90 			":/style/clockalarmlistitemprototype.css");
    99 			":/style/clockalarmlistitemprototype.css");
    91 	HbStyleLoader::unregisterFilePath(
   100 	HbStyleLoader::unregisterFilePath(
    92 			":/style/clockalarmlistitemprototype.widgetml");
   101 			":/style/clockalarmlistitemprototype.widgetml");
    93 	HbStyleLoader::unregisterFilePath(
   102 	HbStyleLoader::unregisterFilePath(
   277 			mTimezoneClient, SIGNAL(autoTimeUpdateChanged(int)),
   286 			mTimezoneClient, SIGNAL(autoTimeUpdateChanged(int)),
   278 			this, SLOT(updatePlaceLabel(int)));
   287 			this, SLOT(updatePlaceLabel(int)));
   279 	connect(
   288 	connect(
   280 			mTimezoneClient, SIGNAL(cityUpdated()),
   289 			mTimezoneClient, SIGNAL(cityUpdated()),
   281 			this, SLOT(updatePlaceLabel()));
   290 			this, SLOT(updatePlaceLabel()));
       
   291 	
       
   292 	// Connect for the clock type changes to refresh the view
       
   293 	mSettingsManager = new XQSettingsManager(this);
       
   294 	mClockTypeSettingsKey = new XQSettingsKey(
       
   295 							XQSettingsKey::TargetCentralRepository,
       
   296 							KCRUidClockApp,
       
   297 							KClockType);
       
   298 	mSettingsManager->startMonitoring(*mClockTypeSettingsKey);
       
   299 	connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)),
       
   300 				this, SLOT(eventMonitor(XQSettingsKey, QVariant)));
   282 	
   301 	
   283 	OstTraceFunctionExit0( CLOCKMAINVIEW_SETUPAFTERVIEWREADY_EXIT );
   302 	OstTraceFunctionExit0( CLOCKMAINVIEW_SETUPAFTERVIEWREADY_EXIT );
   284 }
   303 }
   285 
   304 
   286 /*!
   305 /*!
   494 		mSelectedItem = -1;
   513 		mSelectedItem = -1;
   495 	}
   514 	}
   496 	OstTraceFunctionExit0( CLOCKMAINVIEW_REMOVESNOOZEDALARM_EXIT );
   515 	OstTraceFunctionExit0( CLOCKMAINVIEW_REMOVESNOOZEDALARM_EXIT );
   497 }
   516 }
   498 
   517 
       
   518 /*!
       
   519 	Slot which is called when the value changes in cenrep.
       
   520 
       
   521 	\param key The key which got changed in cenrep.
       
   522 	\param value The new value of that key.
       
   523  */
       
   524 void ClockMainView::eventMonitor(
       
   525 		const XQSettingsKey& key, const QVariant& value)
       
   526 {
       
   527 	OstTraceFunctionEntry0( CLOCKMAINVIEW_EVENTMONITOR_ENTRY );
       
   528 	if (key.uid() == KCRUidClockApp && key.key() == KClockType) {
       
   529 		// Update view
       
   530 		updateView();
       
   531 	}
       
   532 	OstTraceFunctionExit0( CLOCKMAINVIEW_EVENTMONITOR_EXIT );
       
   533 }
       
   534 
       
   535 
   499 void ClockMainView::updateView()
   536 void ClockMainView::updateView()
   500 {
   537 {
   501 	OstTraceFunctionEntry0( CLOCKMAINVIEW_UPDATEVIEW_ENTRY );
   538 	OstTraceFunctionEntry0( CLOCKMAINVIEW_UPDATEVIEW_ENTRY );
   502 	// Update the place label.
   539 	// Update the place label.
   503 	updatePlaceLabel(mTimezoneClient->timeUpdateOn());
   540 	updatePlaceLabel(mTimezoneClient->timeUpdateOn());
   759 	OstTraceFunctionEntry0( CLOCKMAINVIEW_UPDATECLOCKWIDGET_ENTRY );
   796 	OstTraceFunctionEntry0( CLOCKMAINVIEW_UPDATECLOCKWIDGET_ENTRY );
   760 	QStringList clockType;
   797 	QStringList clockType;
   761     int index = mSettingsUtility->clockType(clockType);
   798     int index = mSettingsUtility->clockType(clockType);
   762     int zeroIndex(0);
   799     int zeroIndex(0);
   763     if(zeroIndex == index){
   800     if(zeroIndex == index){
       
   801     	mClockWidget->setClockType(ClockWidget::ClockTypeAnalog);
       
   802     } else {
   764     	mClockWidget->setClockType(ClockWidget::ClockTypeDigital);
   803     	mClockWidget->setClockType(ClockWidget::ClockTypeDigital);
   765     } else {
       
   766     	mClockWidget->setClockType(ClockWidget::ClockTypeAnalog);
       
   767     }
   804     }
   768     
   805     
   769     QStringList timeFormat;
   806     QStringList timeFormat;
   770 
   807 
   771     if (zeroIndex == mSettingsUtility->timeFormat(timeFormat)) {
   808     if (zeroIndex == mSettingsUtility->timeFormat(timeFormat)) {