clock/clockui/clockviews/src/clockworldview.cpp
changeset 57 bb2d3e476f29
parent 55 2c54b51f39c4
child 64 1881ad52dc45
equal deleted inserted replaced
55:2c54b51f39c4 57:bb2d3e476f29
    34 #include "clockcommon.h"
    34 #include "clockcommon.h"
    35 #include "settingsutility.h"
    35 #include "settingsutility.h"
    36 #include "timezoneclient.h"
    36 #include "timezoneclient.h"
    37 #include "clockcityselectionlist.h"
    37 #include "clockcityselectionlist.h"
    38 #include "clockhomecityitem.h"
    38 #include "clockhomecityitem.h"
       
    39 #include "OstTraceDefinitions.h"
       
    40 #ifdef OST_TRACE_COMPILER_IN_USE
       
    41 #include "clockworldviewTraces.h"
       
    42 #endif
       
    43 
    39 
    44 
    40 /*!
    45 /*!
    41 	\class ClockWorldView
    46 	\class ClockWorldView
    42 
    47 
    43 	The world clock view of the clock application.
    48 	The world clock view of the clock application.
    50  */
    55  */
    51 ClockWorldView::ClockWorldView(QGraphicsItem *parent)
    56 ClockWorldView::ClockWorldView(QGraphicsItem *parent)
    52 :HbView(parent),
    57 :HbView(parent),
    53  mSelectedItem(-1)
    58  mSelectedItem(-1)
    54 {
    59 {
       
    60 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_CLOCKWORLDVIEW_ENTRY );
    55 	// Timer for updating list data upon time change/update.
    61 	// Timer for updating list data upon time change/update.
    56 	mRefreshTimer = new QTimer();
    62 	mRefreshTimer = new QTimer();
    57 	connect(
    63 	connect(
    58 			mRefreshTimer, SIGNAL(timeout()),
    64 			mRefreshTimer, SIGNAL(timeout()),
    59 			this, SLOT(refreshCityList()));
    65 			this, SLOT(refreshCityList()));
    60 
    66 
    61 	// Create the model.
    67 	// Create the model.
    62 	mCityListModel = new QStandardItemModel();
    68 	mCityListModel = new QStandardItemModel();
       
    69 	OstTraceFunctionExit0( CLOCKWORLDVIEW_CLOCKWORLDVIEW_EXIT );
    63 }
    70 }
    64 
    71 
    65 /*!
    72 /*!
    66 	Destructor.
    73 	Destructor.
    67  */
    74  */
    68 ClockWorldView::~ClockWorldView()
    75 ClockWorldView::~ClockWorldView()
    69 {
    76 {
       
    77 	OstTraceFunctionEntry0( DUP1_CLOCKWORLDVIEW_CLOCKWORLDVIEW_ENTRY );
    70 	if (mDocLoader) {
    78 	if (mDocLoader) {
    71 		delete mDocLoader;
    79 		delete mDocLoader;
    72 		mDocLoader = 0;
    80 		mDocLoader = 0;
    73 	}
    81 	}
    74 	if(mCityListModel){
    82 	if(mCityListModel){
    76 	}
    84 	}
    77 	
    85 	
    78 	HbStyleLoader::unregisterFilePath(":/style/hblistviewitem.css");
    86 	HbStyleLoader::unregisterFilePath(":/style/hblistviewitem.css");
    79 	HbStyleLoader::unregisterFilePath(":/style/hblistviewitem.widgetml");
    87 	HbStyleLoader::unregisterFilePath(":/style/hblistviewitem.widgetml");
    80 	HbStyleLoader::unregisterFilePath(":/style/hblistviewitem_color.css");
    88 	HbStyleLoader::unregisterFilePath(":/style/hblistviewitem_color.css");
       
    89 	OstTraceFunctionExit0( DUP1_CLOCKWORLDVIEW_CLOCKWORLDVIEW_EXIT );
    81 }
    90 }
    82 
    91 
    83 /*!
    92 /*!
    84 	Called by the ClockViewManager after loading the view from the docml.
    93 	Called by the ClockViewManager after loading the view from the docml.
    85 	The initializaion/setup of the view is done here.
    94 	The initializaion/setup of the view is done here.
    89  */
    98  */
    90 void ClockWorldView::setupView(
    99 void ClockWorldView::setupView(
    91 		ClockAppControllerIf &controllerIf,
   100 		ClockAppControllerIf &controllerIf,
    92 		ClockDocLoader *docLoader)
   101 		ClockDocLoader *docLoader)
    93 {
   102 {
       
   103 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_SETUPVIEW_ENTRY );
    94 	mDocLoader = docLoader;
   104 	mDocLoader = docLoader;
    95 	mAppControllerIf = &controllerIf;
   105 	mAppControllerIf = &controllerIf;
    96 
   106 
    97 	mTimezoneClient = controllerIf.timezoneClient();
   107 	mTimezoneClient = controllerIf.timezoneClient();
    98 	mSettingsUtility = controllerIf.settingsUtility();
   108 	mSettingsUtility = controllerIf.settingsUtility();
   187 	// Check for disabling of addCityAction in view toolbar.
   197 	// Check for disabling of addCityAction in view toolbar.
   188 	if ((KMaximumCityListCount-1) == mCityInfoList.count()) {
   198 	if ((KMaximumCityListCount-1) == mCityInfoList.count()) {
   189 		mAddCityAction->setEnabled(false);
   199 		mAddCityAction->setEnabled(false);
   190 		mAddCityMenuAction->setVisible(false);
   200 		mAddCityMenuAction->setVisible(false);
   191 	}
   201 	}
       
   202 	OstTraceFunctionExit0( CLOCKWORLDVIEW_SETUPVIEW_EXIT );
   192 }
   203 }
   193 
   204 
   194 /*!
   205 /*!
   195 	Refreshes the data in the city list.
   206 	Refreshes the data in the city list.
   196  */
   207  */
   197 void ClockWorldView::refreshCityList()
   208 void ClockWorldView::refreshCityList()
   198 {
   209 {
       
   210 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_REFRESHCITYLIST_ENTRY );
   199 	updateCurrentLocationInfo(mTimezoneClient->timeUpdateOn());
   211 	updateCurrentLocationInfo(mTimezoneClient->timeUpdateOn());
   200 	int cityInfoCount = mCityInfoList.count();
   212 	int cityInfoCount = mCityInfoList.count();
   201 
   213 
   202 	if (cityInfoCount) {
   214 	if (cityInfoCount) {
   203 		QStandardItem *item = 0;
   215 		QStandardItem *item = 0;
   212 		}
   224 		}
   213 
   225 
   214 		// Start the timer again for one minute.
   226 		// Start the timer again for one minute.
   215 		QTimer::singleShot(60 * 1000, this, SLOT(refreshCityList()));
   227 		QTimer::singleShot(60 * 1000, this, SLOT(refreshCityList()));
   216 	}
   228 	}
       
   229 	OstTraceFunctionExit0( CLOCKWORLDVIEW_REFRESHCITYLIST_EXIT );
   217 }
   230 }
   218 
   231 
   219 /*!
   232 /*!
   220 	Updates the current location info.
   233 	Updates the current location info.
   221  */
   234  */
   222 void ClockWorldView::updateCurrentLocationInfo(int networkTime)
   235 void ClockWorldView::updateCurrentLocationInfo(int networkTime)
   223 {
   236 {
       
   237 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_UPDATECURRENTLOCATIONINFO_ENTRY );
   224 	HbMainWindow *window = hbInstance->allMainWindows().first();
   238 	HbMainWindow *window = hbInstance->allMainWindows().first();
   225 	Qt::Orientation currentOrienation = window->orientation();
   239 	Qt::Orientation currentOrienation = window->orientation();
   226 	loadSection(currentOrienation);
   240 	loadSection(currentOrienation);
   227 
   241 
   228 	if (!networkTime) {
   242 	if (!networkTime) {
   266 		}
   280 		}
   267 		itemList.insert(value.setNum(ClockHomeCityItem::Dst), dstIconPath);
   281 		itemList.insert(value.setNum(ClockHomeCityItem::Dst), dstIconPath);
   268 		
   282 		
   269 		mHomeCityWidget->setHomeCityItemData(itemList);
   283 		mHomeCityWidget->setHomeCityItemData(itemList);
   270 	}
   284 	}
       
   285 	OstTraceFunctionExit0( CLOCKWORLDVIEW_UPDATECURRENTLOCATIONINFO_EXIT );
   271 }
   286 }
   272 
   287 
   273 /*!
   288 /*!
   274 	Handles the long press on each item in the citylist.
   289 	Handles the long press on each item in the citylist.
   275 	Displays a list item specific context menu.
   290 	Displays a list item specific context menu.
   278 	\param coords The position where mouse was pressed.
   293 	\param coords The position where mouse was pressed.
   279  */
   294  */
   280 void ClockWorldView::handleItemLongPressed(
   295 void ClockWorldView::handleItemLongPressed(
   281 		HbAbstractViewItem *item, const QPointF &coords)
   296 		HbAbstractViewItem *item, const QPointF &coords)
   282 {
   297 {
       
   298 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_HANDLEITEMLONGPRESSED_ENTRY );
   283 	// Get the ndex of the selected item.
   299 	// Get the ndex of the selected item.
   284 	mSelectedItem = item->modelIndex().row();
   300 	mSelectedItem = item->modelIndex().row();
   285 
   301 
   286 	// On long press we display item specific context menu.
   302 	// On long press we display item specific context menu.
   287 	HbMenu *itemContextMenu = new HbMenu();
   303 	HbMenu *itemContextMenu = new HbMenu();
   294 
   310 
   295 	// Show the menu.
   311 	// Show the menu.
   296 	itemContextMenu->open(this, SLOT(selectedMenuAction(HbAction*)));
   312 	itemContextMenu->open(this, SLOT(selectedMenuAction(HbAction*)));
   297 	itemContextMenu->setPreferredPos(coords);
   313 	itemContextMenu->setPreferredPos(coords);
   298 	itemContextMenu->setAttribute( Qt::WA_DeleteOnClose,true);
   314 	itemContextMenu->setAttribute( Qt::WA_DeleteOnClose,true);
       
   315 	OstTraceFunctionExit0( CLOCKWORLDVIEW_HANDLEITEMLONGPRESSED_EXIT );
   299 }
   316 }
   300 
   317 
   301 /*!
   318 /*!
   302 	This slot is called when Add location action is triggered. It is responsible
   319 	This slot is called when Add location action is triggered. It is responsible
   303 	for launching the city selection list.
   320 	for launching the city selection list.
   304  */
   321  */
   305 void ClockWorldView::handleAddLocation()
   322 void ClockWorldView::handleAddLocation()
   306 {
   323 {
       
   324 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_HANDLEADDLOCATION_ENTRY );
   307 	// Construct the city selection list and show the same.
   325 	// Construct the city selection list and show the same.
   308 	mCitySelectionList = new ClockCitySelectionList(mTimezoneClient, this);
   326 	mCitySelectionList = new ClockCitySelectionList(mTimezoneClient, this);
   309 	connect(
   327 	connect(
   310 			mCitySelectionList, SIGNAL(citySelected(LocationInfo)),
   328 			mCitySelectionList, SIGNAL(citySelected(LocationInfo)),
   311 			this, SLOT(handleCitySelected(LocationInfo)));
   329 			this, SLOT(handleCitySelected(LocationInfo)));
   312 
   330 
   313 	// Show the city list.
   331 	// Show the city list.
   314 	mCitySelectionList->showCityList();
   332 	mCitySelectionList->showCityList();
       
   333 	OstTraceFunctionExit0( CLOCKWORLDVIEW_HANDLEADDLOCATION_EXIT );
   315 }
   334 }
   316 
   335 
   317 /*!
   336 /*!
   318 	This slot handles delete action on the city list. It removes the item from
   337 	This slot handles delete action on the city list. It removes the item from
   319 	the view.
   338 	the view.
   320  */
   339  */
   321 void ClockWorldView::handleDeleteAction()
   340 void ClockWorldView::handleDeleteAction()
   322 {
   341 {
       
   342 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_HANDLEDELETEACTION_ENTRY );
   323 	if (-1 != mSelectedItem) {
   343 	if (-1 != mSelectedItem) {
   324 		QStandardItem *item = mCityListModel->takeItem(mSelectedItem);
   344 		QStandardItem *item = mCityListModel->takeItem(mSelectedItem);
   325 		mCityListModel->removeRow(mSelectedItem);
   345 		mCityListModel->removeRow(mSelectedItem);
   326 		delete item;
   346 		delete item;
   327 
   347 
   338 				!mAddCityAction->isEnabled()) {
   358 				!mAddCityAction->isEnabled()) {
   339 			mAddCityAction->setEnabled(true);
   359 			mAddCityAction->setEnabled(true);
   340 			mAddCityMenuAction->setVisible(true);
   360 			mAddCityMenuAction->setVisible(true);
   341 		}
   361 		}
   342 	}
   362 	}
       
   363 	OstTraceFunctionExit0( CLOCKWORLDVIEW_HANDLEDELETEACTION_EXIT );
   343 }
   364 }
   344 
   365 
   345 /*!
   366 /*!
   346 	This slot sets the selected city as the current location.
   367 	This slot sets the selected city as the current location.
   347  */
   368  */
   348 void ClockWorldView::handleSetAsCurrentLocationAction()
   369 void ClockWorldView::handleSetAsCurrentLocationAction()
   349 {
   370 {
       
   371 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_HANDLESETASCURRENTLOCATIONACTION_ENTRY );
   350 	// Get the info of the selected item.
   372 	// Get the info of the selected item.
   351 	LocationInfo newHomeCity = mCityInfoList[mSelectedItem];
   373 	LocationInfo newHomeCity = mCityInfoList[mSelectedItem];
   352 
   374 
   353 	// Check if time update is set to ON.
   375 	// Check if time update is set to ON.
   354 	// If yes, reset it to OFF and change the home location.
   376 	// If yes, reset it to OFF and change the home location.
   380 	refreshCityList();
   402 	refreshCityList();
   381 
   403 
   382 	// Update the data file.
   404 	// Update the data file.
   383 	mTimezoneClient->saveLocations(mCityInfoList);
   405 	mTimezoneClient->saveLocations(mCityInfoList);
   384 	mSelectedItem = -1;
   406 	mSelectedItem = -1;
       
   407 	OstTraceFunctionExit0( CLOCKWORLDVIEW_HANDLESETASCURRENTLOCATIONACTION_EXIT );
   385 }
   408 }
   386 
   409 
   387 /*!
   410 /*!
   388 	Slot to handle the case when a city has been selected in from the city
   411 	Slot to handle the case when a city has been selected in from the city
   389 	selection list.
   412 	selection list.
   390 
   413 
   391 	\param info of type LocationInfo which contains the city selected.
   414 	\param info of type LocationInfo which contains the city selected.
   392  */
   415  */
   393 void ClockWorldView::handleCitySelected(LocationInfo info)
   416 void ClockWorldView::handleCitySelected(LocationInfo info)
   394 {
   417 {
       
   418 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_HANDLECITYSELECTED_ENTRY );
   395 	// Info is invalid if the timezoneId is set to -1. We don't do anything in
   419 	// Info is invalid if the timezoneId is set to -1. We don't do anything in
   396 	// that case.
   420 	// that case.
   397 	if (-1 != info.timezoneId) {
   421 	if (-1 != info.timezoneId) {
   398 		// Now we check if the city is already added in the list.
   422 		// Now we check if the city is already added in the list.
   399 		bool proceed = true;
   423 		bool proceed = true;
   437 		mAddCityAction->setEnabled(false);
   461 		mAddCityAction->setEnabled(false);
   438 		mAddCityMenuAction->setVisible(false);
   462 		mAddCityMenuAction->setVisible(false);
   439 	}
   463 	}
   440 	// Cleanup.
   464 	// Cleanup.
   441 	mCitySelectionList->deleteLater();
   465 	mCitySelectionList->deleteLater();
       
   466 	OstTraceFunctionExit0( CLOCKWORLDVIEW_HANDLECITYSELECTED_EXIT );
   442 }
   467 }
   443 
   468 
   444 /*!
   469 /*!
   445 	Navigates to the clock alarms view.
   470 	Navigates to the clock alarms view.
   446  */
   471  */
   447 void ClockWorldView::showAlarmsView()
   472 void ClockWorldView::showAlarmsView()
   448 {
   473 {
       
   474 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_SHOWALARMSVIEW_ENTRY );
   449 	mAppControllerIf->switchToView(MainView);
   475 	mAppControllerIf->switchToView(MainView);
       
   476 	OstTraceFunctionExit0( CLOCKWORLDVIEW_SHOWALARMSVIEW_EXIT );
   450 }
   477 }
   451 
   478 
   452 /*!
   479 /*!
   453 	Slot which gets called when `World Clock' action is triggered from the view
   480 	Slot which gets called when `World Clock' action is triggered from the view
   454 	toolbar. This is responsible for reloading the content of worldclock view.
   481 	toolbar. This is responsible for reloading the content of worldclock view.
   455  */
   482  */
   456 void ClockWorldView::refreshWorldView()
   483 void ClockWorldView::refreshWorldView()
   457 {
   484 {
       
   485 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_REFRESHWORLDVIEW_ENTRY );
   458 	mDisplayWorldClockView->setChecked(true);
   486 	mDisplayWorldClockView->setChecked(true);
       
   487 	OstTraceFunctionExit0( CLOCKWORLDVIEW_REFRESHWORLDVIEW_EXIT );
   459 }
   488 }
   460 
   489 
   461 /*!
   490 /*!
   462 	Loads the appropriate section based on window orientaion.
   491 	Loads the appropriate section based on window orientaion.
   463  */
   492  */
   464 void ClockWorldView::loadSection(Qt::Orientation orientation)
   493 void ClockWorldView::loadSection(Qt::Orientation orientation)
   465 {
   494 {
       
   495 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_LOADSECTION_ENTRY );
   466 	bool networkTime = mTimezoneClient->timeUpdateOn();
   496 	bool networkTime = mTimezoneClient->timeUpdateOn();
   467 	bool loadSuccess;
   497 	bool loadSuccess;
   468 	if (Qt::Horizontal == orientation) {
   498 	if (Qt::Horizontal == orientation) {
   469 		if (networkTime) {
   499 		if (networkTime) {
   470 			// Do not show home city.
   500 			// Do not show home city.
   496 					&loadSuccess);
   526 					&loadSuccess);
   497 			mHomeCityWidget->show();
   527 			mHomeCityWidget->show();
   498 		}
   528 		}
   499 	}
   529 	}
   500 	mCityListView->update();
   530 	mCityListView->update();
       
   531 	OstTraceFunctionExit0( CLOCKWORLDVIEW_LOADSECTION_EXIT );
   501 }
   532 }
   502 
   533 
   503 /*!
   534 /*!
   504 	Slot which gets called for timeChanged signal of timezone client.
   535 	Slot which gets called for timeChanged signal of timezone client.
   505 	Refreshes both homecity & city list.
   536 	Refreshes both homecity & city list.
   506  */
   537  */
   507 void ClockWorldView::updateAllLocationInfo()
   538 void ClockWorldView::updateAllLocationInfo()
   508 {
   539 {
       
   540 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_UPDATEALLLOCATIONINFO_ENTRY );
   509 	updateCurrentLocationInfo(mTimezoneClient->timeUpdateOn());
   541 	updateCurrentLocationInfo(mTimezoneClient->timeUpdateOn());
   510 	updateCityList();
   542 	updateCityList();
   511 	refreshCityList();
   543 	refreshCityList();
       
   544 	OstTraceFunctionExit0( CLOCKWORLDVIEW_UPDATEALLLOCATIONINFO_EXIT );
   512 }
   545 }
   513 
   546 
   514 /*!
   547 /*!
   515 	Slot to handle the selected context menu actions
   548 	Slot to handle the selected context menu actions
   516  */
   549  */
   517 void ClockWorldView::selectedMenuAction(HbAction *action)
   550 void ClockWorldView::selectedMenuAction(HbAction *action)
   518 {
   551 {
       
   552 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_SELECTEDMENUACTION_ENTRY );
   519 	if (action == mSetCurrentLocationAction) {
   553 	if (action == mSetCurrentLocationAction) {
   520 		handleSetAsCurrentLocationAction();
   554 		handleSetAsCurrentLocationAction();
   521 	} else if (action == mRemoveCityAction) {
   555 	} else if (action == mRemoveCityAction) {
   522 		handleDeleteAction();
   556 		handleDeleteAction();
   523 	}
   557 	}
       
   558 	OstTraceFunctionExit0( CLOCKWORLDVIEW_SELECTEDMENUACTION_EXIT );
   524 }
   559 }
   525 
   560 
   526 /*!
   561 /*!
   527 	Adds the location info to the city list.
   562 	Adds the location info to the city list.
   528 
   563 
   529 	\param locationInfo Details of the city to be added to the list.
   564 	\param locationInfo Details of the city to be added to the list.
   530  */
   565  */
   531 QModelIndex ClockWorldView::addCityToList(const LocationInfo& locationInfo)
   566 QModelIndex ClockWorldView::addCityToList(const LocationInfo& locationInfo)
   532 {
   567 {
       
   568 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_ADDCITYTOLIST_ENTRY );
   533 	// Here we construct a model item and add it to the list model.
   569 	// Here we construct a model item and add it to the list model.
   534 	QStandardItem *modelItem = new QStandardItem();
   570 	QStandardItem *modelItem = new QStandardItem();
   535 
   571 
   536 	// Add the item to the model.
   572 	// Add the item to the model.
   537 	mCityListModel->appendRow(modelItem);
   573 	mCityListModel->appendRow(modelItem);
   541 			index, getCityListDisplayString(locationInfo), Qt::DisplayRole);
   577 			index, getCityListDisplayString(locationInfo), Qt::DisplayRole);
   542 	mCityListModel->setData(
   578 	mCityListModel->setData(
   543 			index, getCityListDecorationString(locationInfo),
   579 			index, getCityListDecorationString(locationInfo),
   544 			Qt::DecorationRole);
   580 			Qt::DecorationRole);
   545 
   581 
       
   582 	OstTraceFunctionExit0( CLOCKWORLDVIEW_ADDCITYTOLIST_EXIT );
   546 	return index;
   583 	return index;
   547 }
   584 }
   548 
   585 
   549 /*!
   586 /*!
   550 	Checks if the given time is day or night.
   587 	Checks if the given time is day or night.
   553 	\param dateTime Time for which check has to be performed.
   590 	\param dateTime Time for which check has to be performed.
   554 	\return bool True if it is day otherwise false.
   591 	\return bool True if it is day otherwise false.
   555  */
   592  */
   556 bool ClockWorldView::isDay(QDateTime dateTime)
   593 bool ClockWorldView::isDay(QDateTime dateTime)
   557 {
   594 {
       
   595 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_ISDAY_ENTRY );
   558 	// It is day between 6:00 AM and 6:00 PM. Otherwise night.
   596 	// It is day between 6:00 AM and 6:00 PM. Otherwise night.
   559 	if (17 < dateTime.time().hour() || 6 > dateTime.time().hour()) {
   597 	if (17 < dateTime.time().hour() || 6 > dateTime.time().hour()) {
       
   598 		OstTraceFunctionExit0( CLOCKWORLDVIEW_ISDAY_EXIT );
   560 		return false;
   599 		return false;
   561 	}
   600 	}
       
   601 	OstTraceFunctionExit0( DUP1_CLOCKWORLDVIEW_ISDAY_EXIT );
   562 	return true;
   602 	return true;
   563 }
   603 }
   564 
   604 
   565 /*!
   605 /*!
   566 	Returns the QVariantList for citylist to be set for DisplayRole.
   606 	Returns the QVariantList for citylist to be set for DisplayRole.
   568 	/param locationInfo Details of the city to be added to the list.
   608 	/param locationInfo Details of the city to be added to the list.
   569  */
   609  */
   570 QVariantList ClockWorldView::getCityListDisplayString(
   610 QVariantList ClockWorldView::getCityListDisplayString(
   571 		const LocationInfo& locationInfo)
   611 		const LocationInfo& locationInfo)
   572 {
   612 {
       
   613 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_GETCITYLISTDISPLAYSTRING_ENTRY );
   573 	QVariantList displayString;
   614 	QVariantList displayString;
   574 	QDateTime dateTime = QDateTime::currentDateTime();
   615 	QDateTime dateTime = QDateTime::currentDateTime();
   575 	dateTime = dateTime.toUTC();
   616 	dateTime = dateTime.toUTC();
   576 	dateTime = dateTime.addSecs(locationInfo.zoneOffset * 60);
   617 	dateTime = dateTime.addSecs(locationInfo.zoneOffset * 60);
   577 
   618 
   643 
   684 
   644 	// Show the time at that location.
   685 	// Show the time at that location.
   645 	QString timeInfo = dateTime.toString(mSettingsUtility->timeFormatString());
   686 	QString timeInfo = dateTime.toString(mSettingsUtility->timeFormatString());
   646 	displayString.append(timeInfo);
   687 	displayString.append(timeInfo);
   647 
   688 
       
   689 	OstTraceFunctionExit0( CLOCKWORLDVIEW_GETCITYLISTDISPLAYSTRING_EXIT );
   648 	return displayString;
   690 	return displayString;
   649 }
   691 }
   650 
   692 
   651 /*!
   693 /*!
   652 	Returns the QVariantList for citylist to be set for DecorationRole.
   694 	Returns the QVariantList for citylist to be set for DecorationRole.
   654 	/param locationInfo Details of the city to be added to the list.
   696 	/param locationInfo Details of the city to be added to the list.
   655  */
   697  */
   656 QVariantList ClockWorldView::getCityListDecorationString(
   698 QVariantList ClockWorldView::getCityListDecorationString(
   657 		const LocationInfo& locationInfo)
   699 		const LocationInfo& locationInfo)
   658 {
   700 {
       
   701 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_GETCITYLISTDECORATIONSTRING_ENTRY );
   659 	QVariantList decorationString;
   702 	QVariantList decorationString;
   660 	QDateTime dateTime = QDateTime::currentDateTime();
   703 	QDateTime dateTime = QDateTime::currentDateTime();
   661 	dateTime = dateTime.toUTC();
   704 	dateTime = dateTime.toUTC();
   662 	dateTime = dateTime.addSecs(locationInfo.zoneOffset * 60);
   705 	dateTime = dateTime.addSecs(locationInfo.zoneOffset * 60);
   663 
   706 
   675 	if (locationInfo.dstOn) {
   718 	if (locationInfo.dstOn) {
   676 		dstIconPath = "qtg_mono_day_light_saving_time";
   719 		dstIconPath = "qtg_mono_day_light_saving_time";
   677 	}
   720 	}
   678 	decorationString.append(HbIcon(dstIconPath));
   721 	decorationString.append(HbIcon(dstIconPath));
   679 	
   722 	
       
   723 	OstTraceFunctionExit0( CLOCKWORLDVIEW_GETCITYLISTDECORATIONSTRING_EXIT );
   680 	return decorationString;
   724 	return decorationString;
   681 	
   725 	
   682 }
   726 }
   683 
   727 
   684 /*!
   728 /*!
   685 	Updates the city list according to the home city.
   729 	Updates the city list according to the home city.
   686  */
   730  */
   687 void ClockWorldView::updateCityList()
   731 void ClockWorldView::updateCityList()
   688 {
   732 {
       
   733 	OstTraceFunctionEntry0( CLOCKWORLDVIEW_UPDATECITYLIST_ENTRY );
   689 	int cityInfoCount = mCityInfoList.count();
   734 	int cityInfoCount = mCityInfoList.count();
   690 
   735 
   691 	if (cityInfoCount) {
   736 	if (cityInfoCount) {
   692 		bool deletion = false;
   737 		bool deletion = false;
   693 		bool valueUpdated = false;
   738 		bool valueUpdated = false;
   739 		if (valueUpdated) {
   784 		if (valueUpdated) {
   740 			// Update the data file.
   785 			// Update the data file.
   741 			mTimezoneClient->saveLocations(mCityInfoList);
   786 			mTimezoneClient->saveLocations(mCityInfoList);
   742         }
   787         }
   743 	}
   788 	}
       
   789 	OstTraceFunctionExit0( CLOCKWORLDVIEW_UPDATECITYLIST_EXIT );
   744 }
   790 }
   745 
   791 
   746 // End of file-- Don't delete.
   792 // End of file-- Don't delete.