Ejemplo n.º 1
0
void NotifyProvider::LogEventL(const CLogEvent &event)
{
    // store new call
    QString number=QString::fromRawData(reinterpret_cast<const QChar*>(event.Number().Ptr()),event.Number().Length());
    QString direction=QString::fromRawData(reinterpret_cast<const QChar*>(event.Direction().Ptr()),event.Direction().Length());
    QString description=QString::fromRawData(reinterpret_cast<const QChar*>(event.Description().Ptr()),event.Description().Length());
    if (description.contains("Voice call")&&direction.contains("Missed call"))
    {
        TTime times=event.Time();
        RTz tzsession;
        tzsession.Connect();
        tzsession.ConvertToLocalTime(times);
        tzsession.Close();
        TDateTime dts=times.DateTime();
        QDate d; QTime t;
        d.setYMD(dts.Year(),dts.Month()+1,dts.Day()+1);
        t.setHMS(dts.Hour(),dts.Minute(),dts.Second());
        QDateTime dt; dt.setDate(d); dt.setTime(t);
        dt=dt.toLocalTime();
        QString time=dt.toString("d.M.yy hh:mm");

        TNotifyInfo info;
        info.time=time;
        info.timeStamp=dt;
        info.sender=number;
        info.text=findContact(number);
        info.id=-1;
        info.type=EMissedCall;
        iNotifiers.insert(0,info);
        qDebug()<<"store call from"<<info.sender;
        prepareNotifier(EMissedCall);
    }
}
Ejemplo n.º 2
0
void CTzUserDataTest::CachedUserTimeZoneL(RTz& aRTz, TTest aWhatToTest)
	{
	test.Next(_L("Conver times - Server Response to Changes"));
	TInt offset = 60;
	TTime utctime (TDateTime(2000, EMay, 0, 0, 0, 0, 0));
	
	//Convert a given time from UTC to local time using the user-defined time zone
	TTime localtime = utctime ;
	CreateUserTzAndSetCurrentTimeToL(aRTz, offset, offset);
	aRTz.ConvertToLocalTime(localtime);
	TTimeIntervalMinutes minutes;
	localtime.MinutesFrom(utctime, minutes);
	test (minutes == TTimeIntervalMinutes(offset));
	
	localtime = utctime;

	//Convert a given time from UTC to local time when the corrent tz rule is updated 
	if(aWhatToTest==EUpdateCachedTz)
		{
		offset = 120;
		UpdateCurrentTzL(aRTz, offset, offset);
		}
	else if(aWhatToTest==EDeleteCachedTz)
		{
		//Delete the current tz rule which result in system time reverting to the default time zone. 
		DeleteCurrentTzL(aRTz);
		//Convert a given time from UTC to local time using an existing time zone which is the defaut time zone.
		CTzRules* currentRules = aRTz.GetTimeZoneRulesL(0, 9999,ETzUtcTimeReference );
		CleanupStack::PushL(currentRules);
		offset = currentRules->GetOffsetL(utctime, ETzUtcTimeReference);
		CleanupStack::PopAndDestroy(currentRules);
		}
	
	aRTz.ConvertToLocalTime(localtime);
	localtime.MinutesFrom(utctime, minutes);
	test (minutes == TTimeIntervalMinutes(offset));
	}