/*!

 */
void SettingsUtility::setDateFormat(const QString &format)
{
	OstTraceFunctionEntry0( SETTINGSUTILITY_SETDATEFORMAT_ENTRY );
	TLocale locale;
	int index;

	for (index = 0; index < mDisplayDateFormatList.count(); ++index) {
		if (format == mDisplayDateFormatList.at(index)) {
			break;
		}
	}

	switch (index) {
		case 0:
			locale.SetDateFormat(EDateEuropean);
			break;
		case 1:
			locale.SetDateFormat(EDateAmerican);
			break;
		case 2:
			locale.SetDateFormat(EDateJapanese);
			break;
		default:
			//Nothing to do.
			break;
	}

	locale.Set();
	OstTraceFunctionExit0( SETTINGSUTILITY_SETDATEFORMAT_EXIT );
}
Beispiel #2
0
// Regression testcode for EDNJKAA-4WLDAY
// "Cannot synchronise Outlook contacts with German device"
//
// Tests filtering under the following conditions
// Time & date separator '.'
// Time separator ':', date separator '.'
// Time & date separator ':'
// Time separator '.', date separator ':'
//
LOCAL_C void TestFilterLocalesL()
{
    SimpleFilterTestL();
    NonDateBasedFilterTest();
    TInt i=0;
    TLocale example;
    example.SetDateFormat(EDateEuropean);
    for (i=0; i<4; i++)
    {
        example.SetTimeSeparator(TChar('.'),i);
        example.SetDateSeparator(TChar('.'),i);
    }
    example.Set();
    SimpleFilterTestL();

    example.SetDateFormat(EDateAmerican);
    for (i=0; i<4; i++)
    {
        example.SetTimeSeparator(TChar(':'),i);
    }
    example.Set();
    SimpleFilterTestL();

    example.SetDateFormat(EDateJapanese);
    for (i=0; i<4; i++)
    {
        example.SetDateSeparator(TChar(':'),i);
    }
    example.Set();
    SimpleFilterTestL();

    for (i=0; i<4; i++)
    {
        example.SetTimeSeparator(TChar('.'),i);
    }
    example.Set();
    SimpleFilterTestL();
}
/**
@SYMTestCaseID          SYSLIB-LOGENG-CT-0883
@SYMTestCaseDesc	    Tests for CLogClient::ClearLog() function
@SYMTestPriority 	    High
@SYMTestActions  	    Change locale settings,call up ClearLog and try to retrieve event,test for count of number of events in the view.
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
LOCAL_C void TestClearLog2L(CLogClient& aClient)
	{
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-LOGENG-CT-0883 "));
	CLogEvent* event = CLogEvent::NewL();
	CleanupStack::PushL(event);
	event->SetEventType(KLogCallEventTypeUid);

	CTestActive* active = new(ELeave)CTestActive();
	CleanupStack::PushL(active);

	CLogViewEvent* view = CLogViewEvent::NewL(aClient);
	CleanupStack::PushL(view);

	// change Locale
	TLocale locale;
	locale.SetCountryCode(47);//Norway
	locale.SetDateFormat(EDateEuropean);
	locale.SetTimeFormat(ETime12);
	for (int i=0; i<4; i++)
         {
         locale.SetTimeSeparator(TChar('.'),i);
         locale.SetDateSeparator(TChar(':'),i);
         }
	locale.Set();

	// change the log duration settings to 1 day  
	TLogConfig config;
	active->StartL();
	aClient.GetConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	config.iMaxLogSize = KTestEventAge * 2;
	config.iMaxEventAge = 86400;
	active->StartL();
	aClient.ChangeConfig(config, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// add a call event
	active->StartL();
	aClient.AddEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);
	User::After(1000000);
	TTime now;
	now.HomeTime();	
	event->SetTime(now);
	active->StartL();
	aClient.ChangeEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// forward two days
	now+=(TTimeIntervalDays )2;
	User::SetHomeTime(now);
		
	active->StartL();
	aClient.ClearLog(now, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNone);

	// try to retrieve event
	active->StartL();
	aClient.GetEvent(*event, active->iStatus);
	CActiveScheduler::Start();
	TEST2(active->iStatus.Int(), KErrNotFound);;

	TEST(view->CountL() == 0);

	CleanupStack::PopAndDestroy(3); // view, active, event
	}