diff -r 579cc610882e -r ef813d54df51 clock/clockui/clockviews/src/clockworldview.cpp --- a/clock/clockui/clockviews/src/clockworldview.cpp Tue Jul 06 14:14:56 2010 +0300 +++ b/clock/clockui/clockviews/src/clockworldview.cpp Wed Aug 18 09:47:38 2010 +0300 @@ -36,6 +36,11 @@ #include "timezoneclient.h" #include "clockcityselectionlist.h" #include "clockhomecityitem.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "clockworldviewTraces.h" +#endif + /*! \class ClockWorldView @@ -52,6 +57,7 @@ :HbView(parent), mSelectedItem(-1) { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_CLOCKWORLDVIEW_ENTRY ); // Timer for updating list data upon time change/update. mRefreshTimer = new QTimer(); connect( @@ -60,6 +66,7 @@ // Create the model. mCityListModel = new QStandardItemModel(); + OstTraceFunctionExit0( CLOCKWORLDVIEW_CLOCKWORLDVIEW_EXIT ); } /*! @@ -67,6 +74,7 @@ */ ClockWorldView::~ClockWorldView() { + OstTraceFunctionEntry0( DUP1_CLOCKWORLDVIEW_CLOCKWORLDVIEW_ENTRY ); if (mDocLoader) { delete mDocLoader; mDocLoader = 0; @@ -78,6 +86,7 @@ HbStyleLoader::unregisterFilePath(":/style/hblistviewitem.css"); HbStyleLoader::unregisterFilePath(":/style/hblistviewitem.widgetml"); HbStyleLoader::unregisterFilePath(":/style/hblistviewitem_color.css"); + OstTraceFunctionExit0( DUP1_CLOCKWORLDVIEW_CLOCKWORLDVIEW_EXIT ); } /*! @@ -91,6 +100,7 @@ ClockAppControllerIf &controllerIf, ClockDocLoader *docLoader) { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_SETUPVIEW_ENTRY ); mDocLoader = docLoader; mAppControllerIf = &controllerIf; @@ -131,7 +141,7 @@ HbStyleLoader::registerFilePath(":/style/hblistviewitem.css"); HbStyleLoader::registerFilePath(":/style/hblistviewitem.widgetml"); HbStyleLoader::registerFilePath(":/style/hblistviewitem_color.css"); - mCityListView->setLayoutName("citylist-portrait"); + mCityListView->setLayoutName("citylist"); mCityListView->setModel(mCityListModel); // Get the toolbar/menu actions. @@ -189,6 +199,7 @@ mAddCityAction->setEnabled(false); mAddCityMenuAction->setVisible(false); } + OstTraceFunctionExit0( CLOCKWORLDVIEW_SETUPVIEW_EXIT ); } /*! @@ -196,6 +207,7 @@ */ void ClockWorldView::refreshCityList() { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_REFRESHCITYLIST_ENTRY ); updateCurrentLocationInfo(mTimezoneClient->timeUpdateOn()); int cityInfoCount = mCityInfoList.count(); @@ -214,6 +226,7 @@ // Start the timer again for one minute. QTimer::singleShot(60 * 1000, this, SLOT(refreshCityList())); } + OstTraceFunctionExit0( CLOCKWORLDVIEW_REFRESHCITYLIST_EXIT ); } /*! @@ -221,6 +234,7 @@ */ void ClockWorldView::updateCurrentLocationInfo(int networkTime) { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_UPDATECURRENTLOCATIONINFO_ENTRY ); HbMainWindow *window = hbInstance->allMainWindows().first(); Qt::Orientation currentOrienation = window->orientation(); loadSection(currentOrienation); @@ -233,7 +247,7 @@ QString value; QDateTime dateTime = QDateTime::currentDateTime(); - // Show the date. If date is current date then show 'today'. + // Show the date. QString dateInfo = dateTime.toString( mSettingsUtility->dateFormatString()); itemList.insert(value.setNum(ClockHomeCityItem::Date), dateInfo); @@ -260,12 +274,15 @@ ClockHomeCityItem::DayNightIndicator), dayNightIconPath); // Show dst icon when needed. + QString dstIconPath = " "; if (homeCity.dstOn) { - QString dstIconPath = "qtg_mono_day_light_saving_time"; - itemList.insert(value.setNum(ClockHomeCityItem::Dst), dstIconPath); + dstIconPath = "qtg_mono_day_light_saving_time"; } + itemList.insert(value.setNum(ClockHomeCityItem::Dst), dstIconPath); + mHomeCityWidget->setHomeCityItemData(itemList); } + OstTraceFunctionExit0( CLOCKWORLDVIEW_UPDATECURRENTLOCATIONINFO_EXIT ); } /*! @@ -278,6 +295,7 @@ void ClockWorldView::handleItemLongPressed( HbAbstractViewItem *item, const QPointF &coords) { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_HANDLEITEMLONGPRESSED_ENTRY ); // Get the ndex of the selected item. mSelectedItem = item->modelIndex().row(); @@ -294,6 +312,7 @@ itemContextMenu->open(this, SLOT(selectedMenuAction(HbAction*))); itemContextMenu->setPreferredPos(coords); itemContextMenu->setAttribute( Qt::WA_DeleteOnClose,true); + OstTraceFunctionExit0( CLOCKWORLDVIEW_HANDLEITEMLONGPRESSED_EXIT ); } /*! @@ -302,6 +321,7 @@ */ void ClockWorldView::handleAddLocation() { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_HANDLEADDLOCATION_ENTRY ); // Construct the city selection list and show the same. mCitySelectionList = new ClockCitySelectionList(mTimezoneClient, this); connect( @@ -310,6 +330,7 @@ // Show the city list. mCitySelectionList->showCityList(); + OstTraceFunctionExit0( CLOCKWORLDVIEW_HANDLEADDLOCATION_EXIT ); } /*! @@ -318,6 +339,7 @@ */ void ClockWorldView::handleDeleteAction() { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_HANDLEDELETEACTION_ENTRY ); if (-1 != mSelectedItem) { QStandardItem *item = mCityListModel->takeItem(mSelectedItem); mCityListModel->removeRow(mSelectedItem); @@ -338,6 +360,7 @@ mAddCityMenuAction->setVisible(true); } } + OstTraceFunctionExit0( CLOCKWORLDVIEW_HANDLEDELETEACTION_EXIT ); } /*! @@ -345,6 +368,7 @@ */ void ClockWorldView::handleSetAsCurrentLocationAction() { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_HANDLESETASCURRENTLOCATIONACTION_ENTRY ); // Get the info of the selected item. LocationInfo newHomeCity = mCityInfoList[mSelectedItem]; @@ -380,6 +404,7 @@ // Update the data file. mTimezoneClient->saveLocations(mCityInfoList); mSelectedItem = -1; + OstTraceFunctionExit0( CLOCKWORLDVIEW_HANDLESETASCURRENTLOCATIONACTION_EXIT ); } /*! @@ -390,6 +415,7 @@ */ void ClockWorldView::handleCitySelected(LocationInfo info) { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_HANDLECITYSELECTED_ENTRY ); // Info is invalid if the timezoneId is set to -1. We don't do anything in // that case. if (-1 != info.timezoneId) { @@ -437,6 +463,7 @@ } // Cleanup. mCitySelectionList->deleteLater(); + OstTraceFunctionExit0( CLOCKWORLDVIEW_HANDLECITYSELECTED_EXIT ); } /*! @@ -444,7 +471,9 @@ */ void ClockWorldView::showAlarmsView() { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_SHOWALARMSVIEW_ENTRY ); mAppControllerIf->switchToView(MainView); + OstTraceFunctionExit0( CLOCKWORLDVIEW_SHOWALARMSVIEW_EXIT ); } /*! @@ -453,7 +482,9 @@ */ void ClockWorldView::refreshWorldView() { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_REFRESHWORLDVIEW_ENTRY ); mDisplayWorldClockView->setChecked(true); + OstTraceFunctionExit0( CLOCKWORLDVIEW_REFRESHWORLDVIEW_EXIT ); } /*! @@ -461,6 +492,7 @@ */ void ClockWorldView::loadSection(Qt::Orientation orientation) { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_LOADSECTION_ENTRY ); bool networkTime = mTimezoneClient->timeUpdateOn(); bool loadSuccess; if (Qt::Horizontal == orientation) { @@ -496,6 +528,7 @@ } } mCityListView->update(); + OstTraceFunctionExit0( CLOCKWORLDVIEW_LOADSECTION_EXIT ); } /*! @@ -504,9 +537,11 @@ */ void ClockWorldView::updateAllLocationInfo() { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_UPDATEALLLOCATIONINFO_ENTRY ); updateCurrentLocationInfo(mTimezoneClient->timeUpdateOn()); updateCityList(); refreshCityList(); + OstTraceFunctionExit0( CLOCKWORLDVIEW_UPDATEALLLOCATIONINFO_EXIT ); } /*! @@ -514,11 +549,13 @@ */ void ClockWorldView::selectedMenuAction(HbAction *action) { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_SELECTEDMENUACTION_ENTRY ); if (action == mSetCurrentLocationAction) { handleSetAsCurrentLocationAction(); } else if (action == mRemoveCityAction) { handleDeleteAction(); } + OstTraceFunctionExit0( CLOCKWORLDVIEW_SELECTEDMENUACTION_EXIT ); } /*! @@ -528,6 +565,7 @@ */ QModelIndex ClockWorldView::addCityToList(const LocationInfo& locationInfo) { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_ADDCITYTOLIST_ENTRY ); // Here we construct a model item and add it to the list model. QStandardItem *modelItem = new QStandardItem(); @@ -541,6 +579,7 @@ index, getCityListDecorationString(locationInfo), Qt::DecorationRole); + OstTraceFunctionExit0( CLOCKWORLDVIEW_ADDCITYTOLIST_EXIT ); return index; } @@ -553,10 +592,13 @@ */ bool ClockWorldView::isDay(QDateTime dateTime) { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_ISDAY_ENTRY ); // It is day between 6:00 AM and 6:00 PM. Otherwise night. if (17 < dateTime.time().hour() || 6 > dateTime.time().hour()) { + OstTraceFunctionExit0( CLOCKWORLDVIEW_ISDAY_EXIT ); return false; } + OstTraceFunctionExit0( DUP1_CLOCKWORLDVIEW_ISDAY_EXIT ); return true; } @@ -568,6 +610,7 @@ QVariantList ClockWorldView::getCityListDisplayString( const LocationInfo& locationInfo) { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_GETCITYLISTDISPLAYSTRING_ENTRY ); QVariantList displayString; QDateTime dateTime = QDateTime::currentDateTime(); dateTime = dateTime.toUTC(); @@ -618,7 +661,7 @@ } else if ( hours ){ if(hours == 1 ) { - displayFormat = hbTrId("txt_clock_dblist_val_1_hr"); + displayFormat = hbTrId("txt_clock_dblist_daily_val_ln_hr"); offsetString = displayFormat.arg(hours); offsetDifference += offsetString; } @@ -629,7 +672,7 @@ } } else if (minutes){ - displayFormat = hbTrId("txt_clock_dblist_val_1_mins"); + displayFormat = hbTrId("txt_clock_dblist_daily_val_ln_mins"); offsetString = displayFormat.arg(minutes); offsetDifference += offsetString; } else { @@ -643,6 +686,7 @@ QString timeInfo = dateTime.toString(mSettingsUtility->timeFormatString()); displayString.append(timeInfo); + OstTraceFunctionExit0( CLOCKWORLDVIEW_GETCITYLISTDISPLAYSTRING_EXIT ); return displayString; } @@ -654,13 +698,13 @@ QVariantList ClockWorldView::getCityListDecorationString( const LocationInfo& locationInfo) { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_GETCITYLISTDECORATIONSTRING_ENTRY ); QVariantList decorationString; QDateTime dateTime = QDateTime::currentDateTime(); dateTime = dateTime.toUTC(); dateTime = dateTime.addSecs(locationInfo.zoneOffset * 60); // Display day/night indicators. - // TODO: change the icon name for night when available. QString dayNightIconPath = ""; if (isDay(dateTime)) { dayNightIconPath = "qtg_large_clock"; @@ -670,10 +714,13 @@ decorationString.append(HbIcon(dayNightIconPath)); // Show dst icon when needed. + QString dstIconPath = ""; if (locationInfo.dstOn) { - QString dstIconPath = "qtg_mono_day_light_saving_time"; - decorationString.append(HbIcon(dstIconPath)); + dstIconPath = "qtg_mono_day_light_saving_time"; } + decorationString.append(HbIcon(dstIconPath)); + + OstTraceFunctionExit0( CLOCKWORLDVIEW_GETCITYLISTDECORATIONSTRING_EXIT ); return decorationString; } @@ -683,12 +730,15 @@ */ void ClockWorldView::updateCityList() { + OstTraceFunctionEntry0( CLOCKWORLDVIEW_UPDATECITYLIST_ENTRY ); int cityInfoCount = mCityInfoList.count(); if (cityInfoCount) { bool deletion = false; + bool valueUpdated = false; int index; LocationInfo currentCity = mTimezoneClient->getCurrentZoneInfoL(); + // Remove the new home city if it is already added to the list. for (index = 0; index < cityInfoCount; index++) { if (currentCity.timezoneId == mCityInfoList.at(index).timezoneId && (currentCity.cityName == @@ -720,7 +770,23 @@ } } + + for (int index = 0; index < cityInfoCount; ++index) { + int tzid = mCityInfoList[index].timezoneId; + bool dst = mTimezoneClient->isDSTOnL(tzid); + if (dst != mCityInfoList[index].dstOn) { + mCityInfoList[index].dstOn = dst; + valueUpdated = true; + } + + } + + if (valueUpdated) { + // Update the data file. + mTimezoneClient->saveLocations(mCityInfoList); + } } + OstTraceFunctionExit0( CLOCKWORLDVIEW_UPDATECITYLIST_EXIT ); } // End of file-- Don't delete.