clock/clockmw/clocktimezone/src/timezoneclient.cpp
changeset 57 bb2d3e476f29
parent 55 2c54b51f39c4
child 83 5aadd1120515
equal deleted inserted replaced
55:2c54b51f39c4 57:bb2d3e476f29
    30 // User includes
    30 // User includes
    31 #include "timezoneclient.h"
    31 #include "timezoneclient.h"
    32 #include "clockcommon.h"
    32 #include "clockcommon.h"
    33 #include "clockserverclt.h"
    33 #include "clockserverclt.h"
    34 #include "clockprivatecrkeys.h"
    34 #include "clockprivatecrkeys.h"
       
    35 #include "environmentchangenotifier.h"
       
    36 #include "OstTraceDefinitions.h"
       
    37 #ifdef OST_TRACE_COMPILER_IN_USE
       
    38 #include "timezoneclientTraces.h"
       
    39 #endif
       
    40 
    35 
    41 
    36 const int KDaysInWeek(7);
    42 const int KDaysInWeek(7);
    37 const int KZerothRule(0);
    43 const int KZerothRule(0);
    38 const int KOneHour(1);
    44 const int KOneHour(1);
    39 const int KNoDifference(0);
    45 const int KNoDifference(0);
    50 /*!
    56 /*!
    51 	Call this funtion to instantiate the TimezoneClient class.
    57 	Call this funtion to instantiate the TimezoneClient class.
    52  */
    58  */
    53 TimezoneClient* TimezoneClient::getInstance()
    59 TimezoneClient* TimezoneClient::getInstance()
    54 {
    60 {
       
    61 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETINSTANCE_ENTRY );
    55 	if (!mTimezoneClient) {
    62 	if (!mTimezoneClient) {
    56 		mTimezoneClient = new TimezoneClient();
    63 		mTimezoneClient = new TimezoneClient();
    57 		mReferenceCount = true;
    64 		mReferenceCount = true;
    58 	}
    65 	}
    59 
    66 
       
    67 	OstTraceFunctionExit0( TIMEZONECLIENT_GETINSTANCE_EXIT );
    60 	return mTimezoneClient;
    68 	return mTimezoneClient;
    61 }
    69 }
    62 
    70 
    63 /*!
    71 /*!
    64 	Call this function to clean up the instance of TimezoneClient class.
    72 	Call this function to clean up the instance of TimezoneClient class.
    65  */
    73  */
    66 void TimezoneClient::deleteInstance()
    74 void TimezoneClient::deleteInstance()
    67 {
    75 {
       
    76 	OstTraceFunctionEntry0( TIMEZONECLIENT_DELETEINSTANCE_ENTRY );
    68 	if (mReferenceCount) {
    77 	if (mReferenceCount) {
    69 		delete mTimezoneClient;
    78 		delete mTimezoneClient;
    70 		mTimezoneClient = 0;
    79 		mTimezoneClient = 0;
    71 		mReferenceCount = false;
    80 		mReferenceCount = false;
    72 	}
    81 	}
       
    82 	OstTraceFunctionExit0( TIMEZONECLIENT_DELETEINSTANCE_EXIT );
    73 }
    83 }
    74 
    84 
    75 /*!
    85 /*!
    76 	Call this function to check if the object is NULL.
    86 	Call this function to check if the object is NULL.
    77  */
    87  */
    78 bool TimezoneClient::isNull()
    88 bool TimezoneClient::isNull()
    79 {
    89 {
       
    90 	OstTraceFunctionEntry0( TIMEZONECLIENT_ISNULL_ENTRY );
       
    91 	OstTraceFunctionExit0( TIMEZONECLIENT_ISNULL_EXIT );
    80 	return !mReferenceCount;
    92 	return !mReferenceCount;
    81 }
    93 }
    82 
    94 
    83 /*!
    95 /*!
    84 	The constructor.
    96 	The constructor.
    85  */
    97  */
    86 TimezoneClient::TimezoneClient()
    98 TimezoneClient::TimezoneClient()
    87 {
    99 {	
    88 	TCallBack callback(environmentCallback, this);
   100 	OstTraceFunctionEntry0( TIMEZONECLIENT_TIMEZONECLIENT_ENTRY );
    89 
   101 	mNotifier = new EnvironmentChangeNotifier(this);
    90 	mNotifier = CEnvironmentChangeNotifier::NewL(
       
    91 			CActive::EPriorityStandard, callback);
       
    92 	mNotifier->Start();
       
    93 
   102 
    94 	mTzLocalizer = CTzLocalizer::NewL();
   103 	mTzLocalizer = CTzLocalizer::NewL();
    95 
   104 
    96 	// Create the settings manager.
   105 	// Create the settings manager.
    97 	mSettingsManager = new XQSettingsManager(this);
   106 	mSettingsManager = new XQSettingsManager(this);
   110 
   119 
   111 	// Listen to the key value changes.
   120 	// Listen to the key value changes.
   112 	connect(
   121 	connect(
   113 			mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)),
   122 			mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)),
   114 			this, SLOT(eventMonitor(XQSettingsKey, QVariant)));
   123 			this, SLOT(eventMonitor(XQSettingsKey, QVariant)));
       
   124 	OstTraceFunctionExit0( TIMEZONECLIENT_TIMEZONECLIENT_EXIT );
   115 }
   125 }
   116 
   126 
   117 /*!
   127 /*!
   118 	Destructor.
   128 	Destructor.
   119  */
   129  */
   120 TimezoneClient::~TimezoneClient()
   130 TimezoneClient::~TimezoneClient()
   121 {
   131 {
       
   132 	OstTraceFunctionEntry0( DUP1_TIMEZONECLIENT_TIMEZONECLIENT_ENTRY );
   122 	if (mNotifier) {
   133 	if (mNotifier) {
   123 		mNotifier->Cancel();
       
   124 		delete mNotifier;
   134 		delete mNotifier;
   125 		mNotifier = 0;
       
   126 	}
   135 	}
   127 	if (mWorldClockModel) {
   136 	if (mWorldClockModel) {
   128 		mWorldClockModel->clear();
   137 		mWorldClockModel->clear();
   129 	}
   138 	}
   130 	if (mTzLocalizer) {
   139 	if (mTzLocalizer) {
   136 	}
   145 	}
   137 	// Clear the locations if exist.
   146 	// Clear the locations if exist.
   138 	if (mAllLocations.count()) {
   147 	if (mAllLocations.count()) {
   139 		mAllLocations.clear();
   148 		mAllLocations.clear();
   140 	}
   149 	}
   141 
   150 	OstTraceFunctionExit0( DUP1_TIMEZONECLIENT_TIMEZONECLIENT_EXIT );
   142 }
   151 }
   143 
   152 
   144 /*!
   153 /*!
   145 	This functions returns a QList of location info which represent all the
   154 	This functions returns a QList of location info which represent all the
   146 	cities preset in the device returned by the tz server.
   155 	cities preset in the device returned by the tz server.
   149 			valid cityName, countryName, tz id and city group id. None of the other
   158 			valid cityName, countryName, tz id and city group id. None of the other
   150 			data is filled.
   159 			data is filled.
   151  */
   160  */
   152 QList<LocationInfo>& TimezoneClient::getLocations()
   161 QList<LocationInfo>& TimezoneClient::getLocations()
   153 {
   162 {
       
   163 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETLOCATIONS_ENTRY );
   154 	if (mAllLocations.count()) {
   164 	if (mAllLocations.count()) {
   155 		mAllLocations.clear();
   165 		mAllLocations.clear();
   156 	}
   166 	}
   157 
   167 
   158 	// Get the cities, in alphabetical-ascending sorted order.
   168 	// Get the cities, in alphabetical-ascending sorted order.
   200 		mAllLocations.append(cityInfo);
   210 		mAllLocations.append(cityInfo);
   201 	}
   211 	}
   202 
   212 
   203 	// Cleanup.
   213 	// Cleanup.
   204 	CleanupStack::PopAndDestroy(cityArray);
   214 	CleanupStack::PopAndDestroy(cityArray);
       
   215 	OstTraceFunctionExit0( TIMEZONECLIENT_GETLOCATIONS_EXIT );
   205 	return mAllLocations;
   216 	return mAllLocations;
   206 }
   217 }
   207 
   218 
   208 bool TimezoneClient::getUtcDstOffsetL(int& dstOffset, const CTzId& timezoneId)
   219 bool TimezoneClient::getUtcDstOffsetL(int& dstOffset, const CTzId& timezoneId)
   209 {
   220 {
       
   221 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETUTCDSTOFFSETL_ENTRY );
   210 	RTz tzHandle;
   222 	RTz tzHandle;
   211 	User::LeaveIfError(tzHandle.Connect());
   223 	User::LeaveIfError(tzHandle.Connect());
   212 	CleanupClosePushL(tzHandle);
   224 	CleanupClosePushL(tzHandle);
   213 
   225 
   214 	// Local time.
   226 	// Local time.
   262 		if (initialTimeZoneOffset != tVTzactRule.iNewOffset) {
   274 		if (initialTimeZoneOffset != tVTzactRule.iNewOffset) {
   263 			dstOffset = tVTzactRule.iNewOffset;
   275 			dstOffset = tVTzactRule.iNewOffset;
   264 			CleanupStack::PopAndDestroy(actualizedRules);
   276 			CleanupStack::PopAndDestroy(actualizedRules);
   265 			CleanupStack::PopAndDestroy(timezoneRules);
   277 			CleanupStack::PopAndDestroy(timezoneRules);
   266 			CleanupStack::PopAndDestroy(&tzHandle);
   278 			CleanupStack::PopAndDestroy(&tzHandle);
       
   279 			OstTraceFunctionExit0( TIMEZONECLIENT_GETUTCDSTOFFSETL_EXIT );
   267 			return true;
   280 			return true;
   268 		} else {
   281 		} else {
   269 			dstOffset = initialTimeZoneOffset;
   282 			dstOffset = initialTimeZoneOffset;
   270 		}
   283 		}
   271 	}
   284 	}
   272 	CleanupStack::PopAndDestroy(actualizedRules);
   285 	CleanupStack::PopAndDestroy(actualizedRules);
   273 	CleanupStack::PopAndDestroy(timezoneRules);
   286 	CleanupStack::PopAndDestroy(timezoneRules);
   274 	CleanupStack::PopAndDestroy(&tzHandle);
   287 	CleanupStack::PopAndDestroy(&tzHandle);
       
   288 	OstTraceFunctionExit0( DUP1_TIMEZONECLIENT_GETUTCDSTOFFSETL_EXIT );
   275 	return false;
   289 	return false;
   276 }
   290 }
   277 
   291 
   278 LocationInfo TimezoneClient::getCurrentZoneInfoL()
   292 LocationInfo TimezoneClient::getCurrentZoneInfoL()
   279 {
   293 {
       
   294 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETCURRENTZONEINFOL_ENTRY );
   280 	// Current zone info.
   295 	// Current zone info.
   281 	LocationInfo currentLocation;
   296 	LocationInfo currentLocation;
   282 	int timezoneId(0);
   297 	int timezoneId(0);
   283 	int utcOffset(0);
   298 	int utcOffset(0);
   284 
   299 
   401 	}
   416 	}
   402 
   417 
   403 	// Cleanup.
   418 	// Cleanup.
   404 	CleanupStack::PopAndDestroy( tzId );
   419 	CleanupStack::PopAndDestroy( tzId );
   405 	CleanupStack::PopAndDestroy( &tzHandle );
   420 	CleanupStack::PopAndDestroy( &tzHandle );
       
   421 	OstTraceFunctionExit0( TIMEZONECLIENT_GETCURRENTZONEINFOL_EXIT );
   406 	return currentLocation;
   422 	return currentLocation;
   407 }
   423 }
   408 
   424 
   409 void TimezoneClient::setAsCurrentLocationL(LocationInfo &location)
   425 void TimezoneClient::setAsCurrentLocationL(LocationInfo &location)
   410 {
   426 {
   411 /*	Debug::writeDebugMsg(
   427 	OstTraceFunctionEntry0( TIMEZONECLIENT_SETASCURRENTLOCATIONL_ENTRY );
   412 			"In time zone client setAsCurrentLocationL " + location.cityName +
       
   413 			" " +
       
   414 			location.countryName +
       
   415 			" " +
       
   416 			QString::number(location.zoneOffset));*/
       
   417 
       
   418 	LocationInfo prevLocationInfo ;
   428 	LocationInfo prevLocationInfo ;
   419 	prevLocationInfo = getCurrentZoneInfoL();
   429 	prevLocationInfo = getCurrentZoneInfoL();
   420 
   430 	QTime prevLocationTime = QTime::currentTime();
       
   431 	
   421 	mTzLocalizer->SetTimeZoneL( location.timezoneId );
   432 	mTzLocalizer->SetTimeZoneL( location.timezoneId );
   422 
   433 
   423 	TPtrC ptrCityName(
   434 	TPtrC ptrCityName(
   424 			reinterpret_cast<const TText*>(location.cityName.constData()));
   435 			reinterpret_cast<const TText*>(location.cityName.constData()));
   425 	CTzLocalizedCity* localizedCity =
   436 	CTzLocalizedCity* localizedCity =
   432 	CleanupStack::PopAndDestroy( localizedCity );
   443 	CleanupStack::PopAndDestroy( localizedCity );
   433 
   444 
   434 	if(prevLocationInfo.timezoneId == location.timezoneId) {
   445 	if(prevLocationInfo.timezoneId == location.timezoneId) {
   435 		emit cityUpdated();	
   446 		emit cityUpdated();	
   436 	}
   447 	}
       
   448 	
       
   449 	QTime newTime = QTime::currentTime();	
       
   450 	if ((prevLocationTime.hour() == newTime.hour())
       
   451 			&& (prevLocationTime.minute() == newTime.minute())
       
   452 			&& (prevLocationInfo.timezoneId != location.timezoneId)) {
       
   453 	    emit cityUpdated();
       
   454     }
       
   455 	OstTraceFunctionExit0( TIMEZONECLIENT_SETASCURRENTLOCATIONL_EXIT );
   437 }
   456 }
   438 
   457 
   439 bool TimezoneClient::isDSTOnL(int timezoneId)
   458 bool TimezoneClient::isDSTOnL(int timezoneId)
   440 {
   459 {
       
   460 	OstTraceFunctionEntry0( TIMEZONECLIENT_ISDSTONL_ENTRY );
   441 	bool returnVal( false );
   461 	bool returnVal( false );
   442 	CTzId* tzId = CTzId::NewL( timezoneId );
   462 	CTzId* tzId = CTzId::NewL( timezoneId );
   443 	CleanupStack::PushL( tzId );
   463 	CleanupStack::PushL( tzId );
   444 
   464 
   445 	RTz tzHandle;
   465 	RTz tzHandle;
   450 
   470 
   451 	tzHandle.Close();
   471 	tzHandle.Close();
   452 	CleanupStack::PopAndDestroy( &tzHandle );
   472 	CleanupStack::PopAndDestroy( &tzHandle );
   453 	CleanupStack::PopAndDestroy( tzId );
   473 	CleanupStack::PopAndDestroy( tzId );
   454 
   474 
       
   475 	OstTraceFunctionExit0( TIMEZONECLIENT_ISDSTONL_EXIT );
   455 	return returnVal;
   476 	return returnVal;
   456 }
   477 }
   457 
   478 
   458 int TimezoneClient::getStandardOffset(int timezoneId)
   479 int TimezoneClient::getStandardOffset(int timezoneId)
   459 {
   480 {
       
   481 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETSTANDARDOFFSET_ENTRY );
   460 	RTz tzHandle;
   482 	RTz tzHandle;
   461 	User::LeaveIfError(tzHandle.Connect());
   483 	User::LeaveIfError(tzHandle.Connect());
   462 	CleanupClosePushL(tzHandle);
   484 	CleanupClosePushL(tzHandle);
   463 
   485 
   464 	RArray<int> idArray;
   486 	RArray<int> idArray;
   483 	idArray.Close();
   505 	idArray.Close();
   484 
   506 
   485 	// Cleanup.
   507 	// Cleanup.
   486 	CleanupStack::PopAndDestroy(&tzHandle);
   508 	CleanupStack::PopAndDestroy(&tzHandle);
   487 
   509 
       
   510 	OstTraceFunctionExit0( TIMEZONECLIENT_GETSTANDARDOFFSET_EXIT );
   488 	return stdOffset;
   511 	return stdOffset;
   489 }
   512 }
   490 
   513 
   491 void TimezoneClient::getDstRulesL(
   514 void TimezoneClient::getDstRulesL(
   492 		QDateTime &startTime, QDateTime &endTime, int timezoneId)
   515 		QDateTime &startTime, QDateTime &endTime, int timezoneId)
   493 {
   516 {
       
   517 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETDSTRULESL_ENTRY );
   494 	RTz tzHandle;
   518 	RTz tzHandle;
   495 	User::LeaveIfError(tzHandle.Connect());
   519 	User::LeaveIfError(tzHandle.Connect());
   496 	CleanupClosePushL(tzHandle);
   520 	CleanupClosePushL(tzHandle);
   497 
   521 
   498 	// Local time.
   522 	// Local time.
   576 	}
   600 	}
   577 	CleanupStack::PopAndDestroy(actualizedRules);
   601 	CleanupStack::PopAndDestroy(actualizedRules);
   578 	CleanupStack::PopAndDestroy(timezoneRules);
   602 	CleanupStack::PopAndDestroy(timezoneRules);
   579 	CleanupStack::PopAndDestroy(tzId);
   603 	CleanupStack::PopAndDestroy(tzId);
   580 	CleanupStack::PopAndDestroy(&tzHandle);
   604 	CleanupStack::PopAndDestroy(&tzHandle);
       
   605 OstTraceFunctionExit0( TIMEZONECLIENT_GETDSTRULESL_EXIT );
   581 }
   606 }
   582 
   607 
   583 QList<LocationInfo> TimezoneClient::getSavedLocations()
   608 QList<LocationInfo> TimezoneClient::getSavedLocations()
   584 {
   609 {
       
   610 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETSAVEDLOCATIONS_ENTRY );
   585 	QList<LocationInfo> locationList;
   611 	QList<LocationInfo> locationList;
   586 
   612 
   587 	QString fileName(CITY_INFO_DB_PATH);
   613 	QString fileName(CITY_INFO_DB_PATH);
   588 	fileName.append(CITY_INFO_DB);
   614 	fileName.append(CITY_INFO_DB);
   589 
   615 
   591 	if (cityInfoFile.open(QIODevice::ReadOnly)) {
   617 	if (cityInfoFile.open(QIODevice::ReadOnly)) {
   592 		QDataStream writeStream(&cityInfoFile);
   618 		QDataStream writeStream(&cityInfoFile);
   593 		writeStream >> locationList;
   619 		writeStream >> locationList;
   594 		cityInfoFile.close();
   620 		cityInfoFile.close();
   595 	}
   621 	}
       
   622 	OstTraceFunctionExit0( TIMEZONECLIENT_GETSAVEDLOCATIONS_EXIT );
   596 	return locationList;
   623 	return locationList;
   597 }
   624 }
   598 
   625 
   599 void TimezoneClient::saveLocations(const QList<LocationInfo> &locationList)
   626 void TimezoneClient::saveLocations(const QList<LocationInfo> &locationList)
   600 {
   627 {
       
   628 	OstTraceFunctionEntry0( TIMEZONECLIENT_SAVELOCATIONS_ENTRY );
   601 	QDir cityDbDir;
   629 	QDir cityDbDir;
   602 	cityDbDir.mkpath(CITY_INFO_DB_PATH);
   630 	cityDbDir.mkpath(CITY_INFO_DB_PATH);
   603 
   631 
   604 	QString fileName(CITY_INFO_DB_PATH);
   632 	QString fileName(CITY_INFO_DB_PATH);
   605 	fileName.append(CITY_INFO_DB);
   633 	fileName.append(CITY_INFO_DB);
   606 
   634 
   607 	QFile cityInfoFile(fileName);
   635 	QFile cityInfoFile(fileName);
   608 	if (!cityInfoFile.open(QIODevice::WriteOnly)) {
   636 	if (!cityInfoFile.open(QIODevice::WriteOnly)) {
   609 		// Error opening or creating file.
   637 		// Error opening or creating file.
       
   638 		OstTraceFunctionExit0( TIMEZONECLIENT_SAVELOCATIONS_EXIT );
   610 		return;
   639 		return;
   611 	}
   640 	}
   612 	QDataStream writeStream(&cityInfoFile);
   641 	QDataStream writeStream(&cityInfoFile);
   613 	writeStream << locationList;
   642 	writeStream << locationList;
   614 	cityInfoFile.close();
   643 	cityInfoFile.close();
   615 
   644 
   616 	emit listUpdated();
   645 	emit listUpdated();
   617 }
   646 OstTraceFunctionExit0( DUP1_TIMEZONECLIENT_SAVELOCATIONS_EXIT );
   618 
       
   619 void TimezoneClient::getCountries(QMap<QString, int>& countries)
       
   620 {
       
   621 	// Get all the city groups(countries).
       
   622 	QTime t;
       
   623 	t.start();
       
   624 	CTzLocalizedCityGroupArray* cityGroupArray =
       
   625 			mTzLocalizer->GetAllCityGroupsL(CTzLocalizer::ETzAlphaNameAscending);
       
   626 	CleanupStack::PushL(cityGroupArray);
       
   627 
       
   628 	t.restart();
       
   629 	// Iterate through each of the city groups.
       
   630 	for (int i = 0; i < cityGroupArray->Count(); i++) {
       
   631 		CTzLocalizedCityGroup& cityGroup(cityGroupArray->At(i));
       
   632 		TPtrC countryName(cityGroup.Name());
       
   633 
       
   634 		// Get the QString of country name
       
   635 		QString qCountryName = QString::fromUtf16(
       
   636 				countryName.Ptr(),countryName.Length());
       
   637 	    countries[qCountryName] = cityGroup.Id();
       
   638 	}
       
   639 
       
   640 	// Cleanup.
       
   641 	CleanupStack::PopAndDestroy(cityGroupArray);
       
   642 }
   647 }
   643 
   648 
   644 void TimezoneClient::getCitiesForCountry(int id, QMap<QString, int>& cities)
   649 void TimezoneClient::getCitiesForCountry(int id, QMap<QString, int>& cities)
   645 {
   650 {
       
   651 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETCITIESFORCOUNTRY_ENTRY );
   646 	// Get the city group for the given id.
   652 	// Get the city group for the given id.
   647 	CTzLocalizedCityArray* cityArray = mTzLocalizer->GetCitiesInGroupL(id,
   653 	CTzLocalizedCityArray* cityArray = mTzLocalizer->GetCitiesInGroupL(id,
   648 			CTzLocalizer::ETzAlphaNameAscending);
   654 			CTzLocalizer::ETzAlphaNameAscending);
   649 	CleanupStack::PushL(cityArray);
   655 	CleanupStack::PushL(cityArray);
   650 	CTzLocalizedCityArray* unsortedArray = mTzLocalizer->GetCitiesInGroupL(id,
   656 	CTzLocalizedCityArray* unsortedArray = mTzLocalizer->GetCitiesInGroupL(id,
   668 	}
   674 	}
   669 
   675 
   670 	// Cleanup.
   676 	// Cleanup.
   671 	CleanupStack::PopAndDestroy(unsortedArray);
   677 	CleanupStack::PopAndDestroy(unsortedArray);
   672 	CleanupStack::PopAndDestroy(cityArray);
   678 	CleanupStack::PopAndDestroy(cityArray);
       
   679 OstTraceFunctionExit0( TIMEZONECLIENT_GETCITIESFORCOUNTRY_EXIT );
   673 }
   680 }
   674 
   681 
   675 void TimezoneClient::getLocationInfo(
   682 void TimezoneClient::getLocationInfo(
   676 		int groupId, int cityIndex, LocationInfo& cityInfo)
   683 		int groupId, int cityIndex, LocationInfo& cityInfo)
   677 {
   684 {
       
   685 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETLOCATIONINFO_ENTRY );
   678 	TRAPD(
   686 	TRAPD(
   679 			error,
   687 			error,
   680 
   688 
   681 			// Get the localized city group.
   689 			// Get the localized city group.
   682 			CTzLocalizedCityGroup* cityGroup = mTzLocalizer->GetCityGroupL(groupId);
   690 			CTzLocalizedCityGroup* cityGroup = mTzLocalizer->GetCityGroupL(groupId);
   702 			// Cleanup.
   710 			// Cleanup.
   703 			CleanupStack::PopAndDestroy(cityArray);
   711 			CleanupStack::PopAndDestroy(cityArray);
   704 			CleanupStack::PopAndDestroy(cityGroup);
   712 			CleanupStack::PopAndDestroy(cityGroup);
   705 	)
   713 	)
   706 	Q_UNUSED(error)
   714 	Q_UNUSED(error)
       
   715 OstTraceFunctionExit0( TIMEZONECLIENT_GETLOCATIONINFO_EXIT );
   707 }
   716 }
   708 
   717 
   709 QDataStream &operator<<(
   718 QDataStream &operator<<(
   710 		QDataStream &writeStream, const LocationInfo& locationInfo)
   719 		QDataStream &writeStream, const LocationInfo& locationInfo)
   711 {
   720 {
       
   721 	OstTraceFunctionEntry0( _OPERATOR_ENTRY );
   712 	writeStream << locationInfo.cityName
   722 	writeStream << locationInfo.cityName
   713 			<< locationInfo.countryName
   723 			<< locationInfo.countryName
   714 			<< locationInfo.listImageName
   724 			<< locationInfo.listImageName
   715 			<< locationInfo.dstOn
   725 			<< locationInfo.dstOn
   716 			<< locationInfo.timezoneId
   726 			<< locationInfo.timezoneId
   717 			<< locationInfo.zoneOffset;
   727 			<< locationInfo.zoneOffset;
       
   728 	OstTraceFunctionExit0( _OPERATOR_EXIT );
   718 	return writeStream;
   729 	return writeStream;
   719 }
   730 }
   720 
   731 
   721 QDataStream &operator>>(
   732 QDataStream &operator>>(
   722 		QDataStream &readStream, LocationInfo &locationInfo)
   733 		QDataStream &readStream, LocationInfo &locationInfo)
   723 {
   734 {
       
   735 	OstTraceFunctionEntry0( DUP1__OPERATOR_ENTRY );
   724 	readStream >> locationInfo.cityName
   736 	readStream >> locationInfo.cityName
   725 	>> locationInfo.countryName
   737 	>> locationInfo.countryName
   726 	>> locationInfo.listImageName
   738 	>> locationInfo.listImageName
   727 	>> locationInfo.dstOn
   739 	>> locationInfo.dstOn
   728 	>> locationInfo.timezoneId
   740 	>> locationInfo.timezoneId
   729 	>> locationInfo.zoneOffset;
   741 	>> locationInfo.zoneOffset;
       
   742 	OstTraceFunctionExit0( DUP1__OPERATOR_EXIT );
   730 	return readStream;
   743 	return readStream;
   731 }
   744 }
   732 
   745 
   733 int TimezoneClient::environmentCallback(TAny* obj)
       
   734 {
       
   735 	TimezoneClient* self = static_cast<TimezoneClient *> (obj);
       
   736 
       
   737 	int changes = KInitialEvent;
       
   738 	if (self->mNotifier) {
       
   739 		changes = self->mNotifier->Change();
       
   740 	}
       
   741 
       
   742 	if (KInitialEvent <= changes) {
       
   743 		// We're not concerned about handling environment changes in that range.
       
   744 		return 0;
       
   745 	}
       
   746 
       
   747 	if (changes & (EChangesMidnightCrossover |
       
   748 			EChangesLocale |
       
   749 			EChangesSystemTime)) {
       
   750 		emit self->timechanged();
       
   751 	} else {
       
   752 		// Nothing to do.
       
   753 	}
       
   754 	return 0;
       
   755 }
       
   756 
       
   757 int TimezoneClient::getDstZoneOffset(int tzId)
   746 int TimezoneClient::getDstZoneOffset(int tzId)
   758 {
   747 {
       
   748 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETDSTZONEOFFSET_ENTRY );
   759 	// Connect to the timezone server.
   749 	// Connect to the timezone server.
   760 	RTz client;
   750 	RTz client;
   761 	User::LeaveIfError(client.Connect());
   751 	User::LeaveIfError(client.Connect());
   762 	CleanupClosePushL(client);
   752 	CleanupClosePushL(client);
   763 
   753 
   769 	client.GetOffsetsForTimeZoneIdsL(zoneIds, zoneOffsets);
   759 	client.GetOffsetsForTimeZoneIdsL(zoneIds, zoneOffsets);
   770 
   760 
   771 	// Cleanup.
   761 	// Cleanup.
   772 	CleanupStack::PopAndDestroy(&client);
   762 	CleanupStack::PopAndDestroy(&client);
   773 
   763 
       
   764 	OstTraceFunctionExit0( TIMEZONECLIENT_GETDSTZONEOFFSET_EXIT );
   774 	return zoneOffsets[0];
   765 	return zoneOffsets[0];
   775 }
   766 }
   776 
   767 
   777 bool TimezoneClient::dstOn(int tzId)
   768 bool TimezoneClient::dstOn(int tzId)
   778 {
   769 {
       
   770 	OstTraceFunctionEntry0( TIMEZONECLIENT_DSTON_ENTRY );
   779 	// Connect to the timezone server.
   771 	// Connect to the timezone server.
   780 	RTz client;
   772 	RTz client;
   781 	User::LeaveIfError(client.Connect());
   773 	User::LeaveIfError(client.Connect());
   782 	CleanupClosePushL(client);
   774 	CleanupClosePushL(client);
   783 
   775 
   788 
   780 
   789 	// Cleanup.
   781 	// Cleanup.
   790 	CleanupStack::PopAndDestroy(zoneId);
   782 	CleanupStack::PopAndDestroy(zoneId);
   791 	CleanupStack::PopAndDestroy(&client);
   783 	CleanupStack::PopAndDestroy(&client);
   792 
   784 
       
   785 	OstTraceFunctionExit0( TIMEZONECLIENT_DSTON_EXIT );
   793 	return returnVal;
   786 	return returnVal;
   794 }
   787 }
   795 
   788 
   796 int TimezoneClient::getCityGroupIdByName(const QString& name)
   789 int TimezoneClient::getCityGroupIdByName(const QString& name)
   797 {
   790 {
       
   791 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETCITYGROUPIDBYNAME_ENTRY );
   798 	TPtrC namePtr;
   792 	TPtrC namePtr;
   799 	namePtr.Set(name.utf16(), name.length());
   793 	namePtr.Set(name.utf16(), name.length());
   800 
   794 
   801 	// Get the citygroup matching the name.
   795 	// Get the citygroup matching the name.
   802 	CTzLocalizedCityGroup *cityGroup = mTzLocalizer->FindCityGroupByNameL(namePtr);
   796 	CTzLocalizedCityGroup *cityGroup = mTzLocalizer->FindCityGroupByNameL(namePtr);
   806 	int id = cityGroup->Id();
   800 	int id = cityGroup->Id();
   807 
   801 
   808 	// Cleanup.
   802 	// Cleanup.
   809 	CleanupStack::PopAndDestroy(cityGroup);
   803 	CleanupStack::PopAndDestroy(cityGroup);
   810 
   804 
       
   805 	OstTraceFunctionExit0( TIMEZONECLIENT_GETCITYGROUPIDBYNAME_EXIT );
   811 	return id;
   806 	return id;
   812 }
   807 }
   813 
   808 
   814 int TimezoneClient::getCityOffsetByNameAndId(const QString& name, int tzId)
   809 int TimezoneClient::getCityOffsetByNameAndId(const QString& name, int tzId)
   815 {
   810 {
       
   811 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETCITYOFFSETBYNAMEANDID_ENTRY );
   816 	TPtrC namePtr;
   812 	TPtrC namePtr;
   817 	namePtr.Set(name.utf16(), name.length());
   813 	namePtr.Set(name.utf16(), name.length());
   818 
   814 
   819 	// Get the citygroup matching the name.
   815 	// Get the citygroup matching the name.
   820 	CTzLocalizedCityArray *cityArray = mTzLocalizer->GetCitiesL(tzId);
   816 	CTzLocalizedCityArray *cityArray = mTzLocalizer->GetCitiesL(tzId);
   831 	}
   827 	}
   832 
   828 
   833 	// Cleanup.
   829 	// Cleanup.
   834 	CleanupStack::PopAndDestroy(cityArray);
   830 	CleanupStack::PopAndDestroy(cityArray);
   835 
   831 
       
   832 	OstTraceFunctionExit0( TIMEZONECLIENT_GETCITYOFFSETBYNAMEANDID_EXIT );
   836 	return id;
   833 	return id;
   837 }
   834 }
   838 
   835 
   839 void TimezoneClient::setDateTime(QDateTime dateTime)
   836 void TimezoneClient::setDateTime(QDateTime dateTime)
   840 {
   837 {
       
   838 	OstTraceFunctionEntry0( TIMEZONECLIENT_SETDATETIME_ENTRY );
   841 	TMonth month = intToMonth(dateTime.date().month());
   839 	TMonth month = intToMonth(dateTime.date().month());
   842 	TTime current(TDateTime(
   840 	TTime current(TDateTime(
   843 			dateTime.date().year(), month, dateTime.date().day() - 1,
   841 			dateTime.date().year(), month, dateTime.date().day() - 1,
   844 			dateTime.time().hour(), dateTime.time().minute(),
   842 			dateTime.time().hour(), dateTime.time().minute(),
   845 			dateTime.time().second(), dateTime.time().msec() * 1000));
   843 			dateTime.time().second(), dateTime.time().msec() * 1000));
   846 	RTz tz;
   844 	RTz tz;
   847 	User::LeaveIfError(tz.Connect());
   845 	User::LeaveIfError(tz.Connect());
   848 	CleanupClosePushL(tz);
   846 	CleanupClosePushL(tz);
   849 	TInt ret(tz.SetHomeTime(current));
   847 	TInt ret(tz.SetHomeTime(current));
   850 	CleanupStack::PopAndDestroy(&tz);
   848 	CleanupStack::PopAndDestroy(&tz);
       
   849 OstTraceFunctionExit0( TIMEZONECLIENT_SETDATETIME_EXIT );
   851 }
   850 }
   852 
   851 
   853 void TimezoneClient::setTimeUpdateOn(bool timeUpdate)
   852 void TimezoneClient::setTimeUpdateOn(bool timeUpdate)
   854 {
   853 {
       
   854 	OstTraceFunctionEntry0( TIMEZONECLIENT_SETTIMEUPDATEON_ENTRY );
   855 	RClkSrvInterface clkSrvInterface;
   855 	RClkSrvInterface clkSrvInterface;
   856 	User::LeaveIfError(clkSrvInterface.Connect());
   856 	User::LeaveIfError(clkSrvInterface.Connect());
   857 	if (timeUpdate) {
   857 	if (timeUpdate) {
   858 		clkSrvInterface.ActivateAllProtocols();
   858 		clkSrvInterface.ActivateAllProtocols();
   859 	}
   859 	}
   860 	else {
   860 	else {
   861 		clkSrvInterface.DeActivateAllProtocols();
   861 		clkSrvInterface.DeActivateAllProtocols();
   862 	}
   862 	}
   863 	clkSrvInterface.Close();
   863 	clkSrvInterface.Close();
       
   864 OstTraceFunctionExit0( TIMEZONECLIENT_SETTIMEUPDATEON_EXIT );
   864 }
   865 }
   865 
   866 
   866 bool TimezoneClient::timeUpdateOn()
   867 bool TimezoneClient::timeUpdateOn()
   867 {
   868 {
       
   869 	OstTraceFunctionEntry0( TIMEZONECLIENT_TIMEUPDATEON_ENTRY );
   868 	TBool autoTimeUpdateOn;
   870 	TBool autoTimeUpdateOn;
   869 	RClkSrvInterface clkSrvInterface;
   871 	RClkSrvInterface clkSrvInterface;
   870 	User::LeaveIfError(clkSrvInterface.Connect());
   872 	User::LeaveIfError(clkSrvInterface.Connect());
   871 	clkSrvInterface.IsAutoTimeUpdateOn(autoTimeUpdateOn);
   873 	clkSrvInterface.IsAutoTimeUpdateOn(autoTimeUpdateOn);
   872 	clkSrvInterface.Close();
   874 	clkSrvInterface.Close();
       
   875 	OstTraceFunctionExit0( TIMEZONECLIENT_TIMEUPDATEON_EXIT );
   873 	return autoTimeUpdateOn;
   876 	return autoTimeUpdateOn;
   874 }
   877 }
   875 
   878 
   876 QStandardItemModel *TimezoneClient::locationSelectorModel()
       
   877 {
       
   878 	if (!mWorldClockModel) {
       
   879 		createWorldClockModel();
       
   880 	}
       
   881 	return mWorldClockModel;
       
   882 }
       
   883 
       
   884 TMonth TimezoneClient::intToMonth(int month)
   879 TMonth TimezoneClient::intToMonth(int month)
   885 {
   880 {
       
   881 	OstTraceFunctionEntry0( TIMEZONECLIENT_INTTOMONTH_ENTRY );
   886 	switch (month) {
   882 	switch (month) {
   887 		case 1:
   883 		case 1:
   888 			return EJanuary;
   884 			return EJanuary;
   889 		case 2:
   885 		case 2:
   890 			return EFebruary;
   886 			return EFebruary;
   913 			break;
   909 			break;
   914 	}
   910 	}
   915 	return (TMonth) -1;
   911 	return (TMonth) -1;
   916 }
   912 }
   917 
   913 
   918 void TimezoneClient::createWorldClockModel()
       
   919 {
       
   920 	// Construct the model if its not yet done
       
   921 	if (!mWorldClockModel) {
       
   922 		// Create the model
       
   923 		mWorldClockModel = new QStandardItemModel(this);
       
   924 
       
   925 		getCountries(mAllCountries);
       
   926 		mCountryCount = mAllCountries.count();
       
   927 
       
   928 		// Construct the model in asynchronously
       
   929 		QTimer::singleShot(2000, this, SLOT(populateCities()));
       
   930 	}
       
   931 }
       
   932 
       
   933 void TimezoneClient::populateCities()
   914 void TimezoneClient::populateCities()
   934 {
   915 {
       
   916 	OstTraceFunctionEntry0( TIMEZONECLIENT_POPULATECITIES_ENTRY );
   935 	// First iterate over all the counties
   917 	// First iterate over all the counties
   936 	QMapIterator<QString, int> countryIter(mAllCountries);
   918 	QMapIterator<QString, int> countryIter(mAllCountries);
   937 	while (countryIter.hasNext()) {
   919 	while (countryIter.hasNext()) {
   938 		countryIter.next();
   920 		countryIter.next();
   939 		// Create an item for each country and append it to the model
   921 		// Create an item for each country and append it to the model
   954 			// TODO: Define and use proper role
   936 			// TODO: Define and use proper role
   955 			city->setData(cityIter.value(), Qt::UserRole + 200);
   937 			city->setData(cityIter.value(), Qt::UserRole + 200);
   956 			country->appendRow(city);
   938 			country->appendRow(city);
   957 		}
   939 		}
   958 	}
   940 	}
       
   941 OstTraceFunctionExit0( TIMEZONECLIENT_POPULATECITIES_EXIT );
   959 }
   942 }
   960 
   943 
   961 /*!
   944 /*!
   962 	 Checks if DST changes will be applied in the next 24 hours.
   945 	 Checks if DST changes will be applied in the next 24 hours.
   963 
   946 
   964 	 \param alarmInfo reference to alarm info
   947 	 \param alarmInfo reference to alarm info
   965 	 \return true if there is DST change otherwise false
   948 	 \return true if there is DST change otherwise false
   966  */
   949  */
   967 bool TimezoneClient::checkForDstChange(AlarmInfo& alarmInfo)
   950 bool TimezoneClient::checkForDstChange(AlarmInfo& alarmInfo)
   968 {
   951 {
       
   952 	OstTraceFunctionEntry0( TIMEZONECLIENT_CHECKFORDSTCHANGE_ENTRY );
   969 	// User to be notified whether DST rollover happens in a day or
   953 	// User to be notified whether DST rollover happens in a day or
   970 	// has happen within a day if he tries to change the time.
   954 	// has happen within a day if he tries to change the time.
   971 	bool returnValue( EFalse );
   955 	bool returnValue( EFalse );
   972 
   956 
   973 	// Establish connection with RTz to get the timezone ID
   957 	// Establish connection with RTz to get the timezone ID
  1091 	CleanupStack::PopAndDestroy( vActualisedRules);
  1075 	CleanupStack::PopAndDestroy( vActualisedRules);
  1092 	CleanupStack::PopAndDestroy( currentRules );
  1076 	CleanupStack::PopAndDestroy( currentRules );
  1093 	CleanupStack::PopAndDestroy( currentTZId );
  1077 	CleanupStack::PopAndDestroy( currentTZId );
  1094 	CleanupStack::PopAndDestroy( &tzHandle );
  1078 	CleanupStack::PopAndDestroy( &tzHandle );
  1095 
  1079 
       
  1080 	OstTraceFunctionExit0( TIMEZONECLIENT_CHECKFORDSTCHANGE_EXIT );
  1096 	return returnValue;
  1081 	return returnValue;
  1097 }
  1082 }
  1098 
  1083 
  1099 /*!
  1084 /*!
  1100 	Get all time zone ids
  1085 	Get all time zone ids
  1101 
  1086 
  1102 	\return list of time zone ids
  1087 	\return list of time zone ids
  1103  */
  1088  */
  1104 QList<int> TimezoneClient::getAllTimeZoneIds()
  1089 QList<int> TimezoneClient::getAllTimeZoneIds()
  1105 {
  1090 {
       
  1091 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETALLTIMEZONEIDS_ENTRY );
  1106 	if (mTimeZoneIds.count()) {
  1092 	if (mTimeZoneIds.count()) {
       
  1093 		OstTraceFunctionExit0( TIMEZONECLIENT_GETALLTIMEZONEIDS_EXIT );
  1107 		return mTimeZoneIds;
  1094 		return mTimeZoneIds;
  1108 	} else {
  1095 	} else {
  1109 		// This list will contain the info of the cities fetched from tz server.
  1096 		// This list will contain the info of the cities fetched from tz server.
  1110 		QList<LocationInfo> infoList;
  1097 		QList<LocationInfo> infoList;
  1111 
  1098 
  1125 				mTimeZoneIds.append(tzId);
  1112 				mTimeZoneIds.append(tzId);
  1126 			}
  1113 			}
  1127 		}
  1114 		}
  1128 
  1115 
  1129 		CleanupStack::PopAndDestroy(cityArray);
  1116 		CleanupStack::PopAndDestroy(cityArray);
       
  1117 		OstTraceFunctionExit0( DUP1_TIMEZONECLIENT_GETALLTIMEZONEIDS_EXIT );
  1130 		return mTimeZoneIds;
  1118 		return mTimeZoneIds;
  1131 	}
  1119 	}
  1132 }
  1120 }
  1133 
  1121 
  1134 /*!
  1122 /*!
  1136 
  1124 
  1137 	\return list of time zone ids
  1125 	\return list of time zone ids
  1138  */
  1126  */
  1139 QList<int> TimezoneClient::getAllTimeZoneOffsets()
  1127 QList<int> TimezoneClient::getAllTimeZoneOffsets()
  1140 {
  1128 {
       
  1129 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETALLTIMEZONEOFFSETS_ENTRY );
  1141 	QList<int> timeZoneOffsetList;
  1130 	QList<int> timeZoneOffsetList;
  1142 	QList<int> timeZoneIdList;
  1131 	QList<int> timeZoneIdList;
  1143 	if (mTimeZoneIds.count()) {
  1132 	if (mTimeZoneIds.count()) {
  1144 		timeZoneIdList = mTimeZoneIds;
  1133 		timeZoneIdList = mTimeZoneIds;
  1145 	} else {
  1134 	} else {
  1171 
  1160 
  1172 	tzHandle.Close();
  1161 	tzHandle.Close();
  1173 	CleanupStack::PopAndDestroy( &tzHandle );
  1162 	CleanupStack::PopAndDestroy( &tzHandle );
  1174 	// Sort the offset list
  1163 	// Sort the offset list
  1175 	qSort(timeZoneOffsetList.begin(),timeZoneOffsetList.end());
  1164 	qSort(timeZoneOffsetList.begin(),timeZoneOffsetList.end());
       
  1165 	OstTraceFunctionExit0( TIMEZONECLIENT_GETALLTIMEZONEOFFSETS_EXIT );
  1176 	return timeZoneOffsetList;
  1166 	return timeZoneOffsetList;
  1177 }
  1167 }
  1178 
  1168 
  1179 
  1169 
  1180 /*!
  1170 /*!
  1182 
  1172 
  1183 	\param list of countries infomation having the same UTC offsets
  1173 	\param list of countries infomation having the same UTC offsets
  1184  */
  1174  */
  1185 QList<LocationInfo> TimezoneClient::getCountriesForUTCOffset(int utcOffset)
  1175 QList<LocationInfo> TimezoneClient::getCountriesForUTCOffset(int utcOffset)
  1186 {
  1176 {
       
  1177 	OstTraceFunctionEntry0( TIMEZONECLIENT_GETCOUNTRIESFORUTCOFFSET_ENTRY );
  1187 	// This list will contain the info of the countries.
  1178 	// This list will contain the info of the countries.
  1188 	QList<LocationInfo> countryList;
  1179 	QList<LocationInfo> countryList;
  1189 	QList<int> cityGroupIdList;
  1180 	QList<int> cityGroupIdList;
  1190 
  1181 
  1191 	// Get all cities for the UTC offset.
  1182 	// Get all cities for the UTC offset.
  1216 			delete country;
  1207 			delete country;
  1217 		}
  1208 		}
  1218 	}
  1209 	}
  1219 	cityGroupIdList.clear();
  1210 	cityGroupIdList.clear();
  1220 	CleanupStack::PopAndDestroy(cityList);
  1211 	CleanupStack::PopAndDestroy(cityList);
       
  1212 	OstTraceFunctionExit0( TIMEZONECLIENT_GETCOUNTRIESFORUTCOFFSET_EXIT );
  1221 	return countryList;
  1213 	return countryList;
  1222 }
  1214 }
  1223 
  1215 
  1224 /*!
  1216 /*!
  1225 	Add a new city to the city list using the
  1217 	Add a new city to the city list using the
  1230 	\cityGroupId Group Id of the country
  1222 	\cityGroupId Group Id of the country
  1231  */
  1223  */
  1232 LocationInfo TimezoneClient::addCity(
  1224 LocationInfo TimezoneClient::addCity(
  1233 		int timeZoneId,QString &cityName,int cityGroupId)
  1225 		int timeZoneId,QString &cityName,int cityGroupId)
  1234 {
  1226 {
       
  1227 	OstTraceFunctionEntry0( TIMEZONECLIENT_ADDCITY_ENTRY );
  1235 	TPtrC namePtr;
  1228 	TPtrC namePtr;
  1236 	namePtr.Set(cityName.utf16(), cityName.length());
  1229 	namePtr.Set(cityName.utf16(), cityName.length());
  1237 
  1230 
  1238 	// Add a new city using the localizer
  1231 	// Add a new city using the localizer
  1239 	CTzLocalizedCity* newCity =
  1232 	CTzLocalizedCity* newCity =
  1247 	info.cityName = QString::fromUtf16(
  1240 	info.cityName = QString::fromUtf16(
  1248 			newCityName.Ptr(), newCityName.Length());
  1241 			newCityName.Ptr(), newCityName.Length());
  1249 
  1242 
  1250 	CleanupStack::PopAndDestroy(newCity);
  1243 	CleanupStack::PopAndDestroy(newCity);
  1251 
  1244 
       
  1245 	OstTraceFunctionExit0( TIMEZONECLIENT_ADDCITY_EXIT );
  1252 	return info;
  1246 	return info;
  1253 }
  1247 }
  1254 
  1248 
  1255 /*!
  1249 /*!
  1256 	Slot which is called when the value changes in cevrep.
  1250 	Slot which is called when the value changes in cevrep.
  1258 	\param key The key which got changed in cenrep.
  1252 	\param key The key which got changed in cenrep.
  1259 	\param value The new value of that key.
  1253 	\param value The new value of that key.
  1260  */
  1254  */
  1261 void TimezoneClient::eventMonitor(const XQSettingsKey& key, const QVariant& value)
  1255 void TimezoneClient::eventMonitor(const XQSettingsKey& key, const QVariant& value)
  1262 {
  1256 {
       
  1257 	OstTraceFunctionEntry0( TIMEZONECLIENT_EVENTMONITOR_ENTRY );
  1263 	if (key.uid() == KCRUidNitz && key.key() == KActiveProtocol) {
  1258 	if (key.uid() == KCRUidNitz && key.key() == KActiveProtocol) {
  1264 		if (mSettingsManager->error() == XQSettingsManager::NoError) {
  1259 		if (mSettingsManager->error() == XQSettingsManager::NoError) {
  1265 
  1260 
  1266 			// New value of auto time update.
  1261 			// New value of auto time update.
  1267 			int autoTimeUpdate = value.toInt();
  1262 			int autoTimeUpdate = value.toInt();
  1273 				mAutoTimeUpdateValue = autoTimeUpdate;
  1268 				mAutoTimeUpdateValue = autoTimeUpdate;
  1274 				emit autoTimeUpdateChanged(mAutoTimeUpdateValue);
  1269 				emit autoTimeUpdateChanged(mAutoTimeUpdateValue);
  1275 			}
  1270 			}
  1276 		}
  1271 		}
  1277 	}
  1272 	}
       
  1273 OstTraceFunctionExit0( TIMEZONECLIENT_EVENTMONITOR_EXIT );
       
  1274 }
       
  1275 
       
  1276 void TimezoneClient::notifyTimeChange()
       
  1277 {
       
  1278 	OstTraceFunctionEntry0( TIMEZONECLIENT_NOTIFYTIMECHANGE_ENTRY );
       
  1279 	emit timechanged();
       
  1280 OstTraceFunctionExit0( TIMEZONECLIENT_NOTIFYTIMECHANGE_EXIT );
  1278 }
  1281 }
  1279 // End of file	--Don't remove this.
  1282 // End of file	--Don't remove this.