当前位置: 首页>>代码示例>>C++>>正文


C++ TCalTime::SetTimeLocalL方法代码示例

本文整理汇总了C++中TCalTime::SetTimeLocalL方法的典型用法代码示例。如果您正苦于以下问题:C++ TCalTime::SetTimeLocalL方法的具体用法?C++ TCalTime::SetTimeLocalL怎么用?C++ TCalTime::SetTimeLocalL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TCalTime的用法示例。


在下文中一共展示了TCalTime::SetTimeLocalL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DeleteInstancesL

/**
* Delete all Instances in the calendar file 
*/
void CTestCalInterimApiModifier::DeleteInstancesL()
	{
 	CCalInstanceView* instanceView = CCalInstanceView::NewL(GetSession(), *this);
	CleanupStack::PushL(instanceView);
	CActiveScheduler::Start();
	TInt err;
	RPointerArray<CCalInstance>	instanceArray;
	TCalTime	calStartDateTime;
	calStartDateTime.SetTimeLocalL(TCalTime::MinTime());
	TCalTime	calEndDateTime;
	calEndDateTime.SetTimeLocalL(TCalTime::MaxTime());
	CalCommon::TCalTimeRange	calTimeRange(calStartDateTime, calEndDateTime);

	CleanupStack::PushL(TCleanupItem(ResetAndDestroyInstanceArray, &instanceArray));
	instanceView->FindInstanceL(instanceArray, CalCommon::EIncludeAll, calTimeRange);
	if(instanceArray.Count() != 0)
		{
		TRAP(err, instanceView->DeleteL(instanceArray[0], CalCommon::EThisAndAll));
		instanceArray.Remove(0);
		if(err != KErrNone)
			{
			iTestStep->ERR_PRINTF2(KErrDeleteOperation,err);
			iTestStep->SetTestStepResult(EFail);
			}
		}
	else
		{
		iTestStep->WARN_PRINTF1(KWarnInstancesNotFound);
		}
		
	CleanupStack::PopAndDestroy();// instanceArray
	CleanupStack::PopAndDestroy(); // instanceView
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:36,代码来源:TestCalInterimApiModifier.cpp

示例2: DeleteEntryL

void CDummyCalendarApp::DeleteEntryL(const TTime& aStart,const TTime& aEnd, CalCommon::TCalViewFilter aFilter)
	{
	TCalTime startTime;
    TCalTime endTime;
    startTime.SetTimeLocalL(aStart);
    endTime.SetTimeLocalL(aEnd);
    CalCommon::TCalTimeRange range(startTime,endTime);
	iProgressNotifications = 0;
	iLocalEntryView->DeleteL(range, aFilter, *this); 
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:10,代码来源:tcal_delete.cpp

示例3: RepeatExceptedEntryCreateL

void CDummyCalendarApp::RepeatExceptedEntryCreateL()
	{
	test.Next(_L("Add entry, repeat twice, set excepted and delete"));

	iEntries.ResetAndDestroy();	
	
	// Create new calendar entry.
	CCalEntry* entry = NULL;
	HBufC8* guid = KGUIDInc081869().AllocLC();	
	entry = CreateCalEntryL(CCalEntry::EAppt, guid);
	CleanupStack::Pop(guid);
	
	iEntries.AppendL(entry);	

    // Set start and end date.
	TTime start(TDateTime(2006, EMarch, 6, 10, 0, 0, 0));
	TTime end(TDateTime(2006, EMarch, 6, 14, 0, 0, 0));
	SetEntryStartAndEndTimeL(entry, start, end);
	
	TBuf<50> summary;			
	RandomText(summary);
	entry->SetSummaryL(summary);

	TBuf<50> location;
	RandomText(location);
	entry->SetLocationL(location);

	TBuf<50> description;		
	RandomText(description);
	entry->SetDescriptionL(description);	

	// Create a daily repeating rule that occurs for 2 days.
	TCalRRule rpt(TCalRRule::EDaily);
	rpt.SetInterval(1);
	rpt.SetCount(2);	
	
	// Make sure the repeat time is within the delete time range.
	TCalTime repeatStart;
	TCalTime repeatEnd;
	repeatStart.SetTimeLocalL(TDateTime(2006, EMarch, 6, 0, 0, 0, 0));
	repeatEnd.SetTimeLocalL(TDateTime(2006, EMarch, 8, 0, 0, 0, 0));
	rpt.SetDtStart(repeatStart); 
	rpt.SetUntil(repeatEnd);
	entry->SetRRuleL(rpt);

    // Store the entry. Because it repeats over 2 days, there will
    // be 2 entries.
	TInt entriesStored(0);
	SynCGetEntryViewL().StoreL(iEntries, entriesStored);
	test(entriesStored == iEntries.Count());
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:51,代码来源:tcal_delete.cpp

示例4: ConvertBooleanToAgnL

// -----------------------------------------------------------------------------
// CPIMAgnToDoAdapter::ConvertBooleanToAgnL
// Makes boolean conversion from framework PIM item data field to To-do item field
// -----------------------------------------------------------------------------
//
void CPIMAgnToDoAdapter::ConvertBooleanToAgnL(TPIMToDoField aField, // Boolean field to be converted
        TInt aIndex, // Index of the date field
        CCalEntry& aEntry, // The Agenda model entry typecasted to a Todo item
        const MPIMItemData& aItem) // The PIM item to read the field from
{
    JELOG2(EPim);
    const TPIMFieldData fieldData = aItem.ValueL(aField, aIndex);
    TBool booleanField = fieldData.BooleanValue();

    if (booleanField) // completed flag is set to value TRUE
    {
        // Check if the completed date field is present
        if (aItem.CountValues(EPIMToDoCompletionDate) == 0)
        {
            // If completed date is not present, use the current time.
            TTime currentTime;
            currentTime.HomeTime();
            TCalTime calCurrentTime;
            // Set time as local time since acquired above as local time
            calCurrentTime.SetTimeLocalL(currentTime);
            aEntry.SetCompletedL(ETrue, calCurrentTime);
        }
        else
        {
            TPIMFieldData completionData = aItem.ValueL(EPIMToDoCompletionDate,
                                           aIndex);
            const TPIMDate& date = completionData.DateValue();
            if (date != Time::NullTTime())
            {
                TCalTime calDate;
                calDate.SetTimeUtcL(date);
                aEntry.SetCompletedL(ETrue, calDate);
            }
            else
            {
                // If completed date is set to null time, use the current time.
                TTime currentTime;
                currentTime.HomeTime();
                TCalTime calCurrentTime;
                // Set time as local time since acquired above as local time
                calCurrentTime.SetTimeLocalL(currentTime);
                aEntry.SetCompletedL(ETrue, calCurrentTime);
            }
        }
    }
    else // completed flag is set to value FALSE
    {
        aEntry.SetCompletedL(EFalse, aEntry.CompletedTimeL());
    }
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:55,代码来源:cpimagntodoadapter.cpp

示例5: AddDefaultValuesToEntryL

// -----------------------------------------------------------------------------
// CPIMAgnToDoAdapter::AddDefaultValuesToEntryL
// (other items were commented in a header)
// -----------------------------------------------------------------------------
//
void CPIMAgnToDoAdapter::AddDefaultValuesToEntryL(const MPIMItemData& aData,
        CCalEntry& aEntry) const
{
    JELOG2(EPim);
    // Calendar creates medium priority ToDos by default
    if (!aData.CountValues(EPIMToDoPriority))
    {
        aEntry.SetPriorityL(EPIMToDoNativePriorityMedium);
    }
    // Calendar uses private synchronization by default
    if (!aData.CountValues(EPIMToDoClass))
    {
        aEntry.SetReplicationStatusL(CCalEntry::EPrivate);
    }
    // Calendar does not support timed ToDo so the time is set to 00:00 o'clock
    if (!aData.CountValues(EPIMToDoDue))
    {
        TTime thisTime;
        thisTime.HomeTime();
        // Set time to calendar specific due time. Currently this is the start
        // of the date. Note that No conversion needed since time is local
        TCalTime calThisTime;
        // Set time as local time since acquired above as local time
        calThisTime.SetTimeLocalL(StartOfDay(thisTime));
        aEntry.SetStartAndEndTimeL(calThisTime, calThisTime);
    }
    if (!aData.CountValues(EPIMToDoCompletionDate) && !aData.CountValues(
                EPIMToDoCompleted))
    {
        aEntry.SetCompletedL(EFalse, aEntry.CompletedTimeL());
    }

}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:38,代码来源:cpimagntodoadapter.cpp

示例6: TestFindInstancesL

void CCalOOMTest::TestFindInstancesL(const TDesC& aFindStartTime, const TDesC& aFindEndTime, CalCommon::TCalViewFilter aFilter)
	{
	test.Next(_L("OOM tests for FindInstanceL"));

	_LIT(KSearchText,				"summary");
	TCalTime findSt;
	findSt.SetTimeLocalL(TTime(aFindStartTime));
	TCalTime findEnd;
	findEnd.SetTimeLocalL(TTime(aFindEndTime));
	CalCommon::TCalTimeRange range(findSt, findEnd);
	
	RPointerArray<CCalInstance> instances;
	CCalInstanceView::TCalSearchParams params(KSearchText, CalCommon::EFoldedTextSearch);
	
	CCalInstanceView& view = iTestLib->SynCGetInstanceViewL();
	
	TInt tryCount = 1;
	TInt err = 0;
	
	// OOM LOOP
	for ( ;; )
		{
		
		RDebug::Printf("%d", tryCount);
		instances.ResetAndDestroy();
		__UHEAP_SETFAIL(RHeap::EFailNext, tryCount);
		
		__UHEAP_MARK;
		TRAP(err, view.FindInstanceL(instances, aFilter, range, params));
		if(	instances.Count()>0 )
		{
			instances.ResetAndDestroy();	//we are responsible for Cleanup of this array
		}
		__UHEAP_MARKEND;
	
		if ( err==KErrNone ) 
		{
			__UHEAP_RESET;
			RDebug::Printf("Memory allocation testing for FindInstance is done");
			break;
		}
		test(err == KErrNoMemory);
		__UHEAP_SETFAIL(RHeap::ENone, 0);		
		tryCount++;
		}
	// OOM LOOP
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:47,代码来源:TCal_OOMFIND.cpp

示例7: ConvertDateToAgnL

// -----------------------------------------------------------------------------
// CPIMAgnToDoAdapter::ConvertDateToAgnL
// Makes date conversion from framework PIM item data field to To-do item field.
// -----------------------------------------------------------------------------
//
void CPIMAgnToDoAdapter::ConvertDateToAgnL(TPIMToDoField aField, // Date field to be converted
        TInt aIndex, // Index of the date field
        CCalEntry& aEntry, const MPIMItemData& aItem) // The PIM item to read the field from
{
    JELOG2(EPim);
    const TPIMFieldData fieldData = aItem.ValueL(aField, aIndex);
    const TPIMDate& date = fieldData.DateValue();
    switch (aField)
    {
    case EPIMToDoDue:
    {
        // Because undated to-dos are possible, the due date can be set
        // to a null value.
        if (date != Time::NullTTime() && !IsDateInValidAgendaRange(date))
        {
            User::Leave(KErrAbort);
        }
        // Java dates cannot be set to native null TTime
        else
        {
            // Convert due date and time to calendar specific due time
            // Note that PIM API dates are in UTC time format -> convert
            TTime dueDate(date);
            ConvertTimeL(dueDate, EPIMDateLocal);
            // Set time to native entry. Note that the time is local
            TCalTime calDate;
            calDate.SetTimeLocalL(StartOfDay(dueDate));
            aEntry.SetStartAndEndTimeL(calDate, calDate);
        }
        break;
    }
    case EPIMToDoCompletionDate:
    {
        if (date != Time::NullTTime())
        {
            __ASSERT_ALWAYS(IsDateInValidAgendaRange(date), User::Leave(
                                KErrAbort));
            TCalTime calDate;
            calDate.SetTimeUtcL(date);
            aEntry.SetCompletedL(ETrue, calDate);
        }
        else
        {
            aEntry.SetCompletedL(EFalse, aEntry.CompletedTimeL());
        }
        break;
    }
    default:
    {
        __ASSERT_DEBUG(EFalse, User::Panic(KPIMPanicCategory,
                                           EPIMPanicUnsupportedField));
    }
    }
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:59,代码来源:cpimagntodoadapter.cpp

示例8: SetCalTimeL

/**
  * Converts the TTime to TCalTime based on the time mode given
  @param aTimeData TTime variable to be set in the specified time mode
  @param aCalTimeData time that is set in the specified time mode
  @param aTimeMode time mode of the entry
  */
void CTestCalInterimApiSuiteStepBase::SetCalTimeL(const TTime& aTimeData, TCalTime& aCalTimeData, TCalTime::TTimeMode aTimeMode)
	{
	if(aTimeMode == TCalTime::EFloating)
		{
		aCalTimeData.SetTimeLocalFloatingL(aTimeData);
		}
	else if(aTimeMode == TCalTime::EFixedTimeZone)
		{
		aCalTimeData.SetTimeLocalL(aTimeData);
		}
	else
		{
		aCalTimeData.SetTimeUtcL(aTimeData);
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:21,代码来源:TestCalInterimApiSuiteStepBase.cpp

示例9: endtimetime

void CDummyCalendarApp::Add3ReminderAnd1ApptL()
	{
	test.Next(_L("Create some entries including day note and delete them"));


//Create entries	
	iEntries.ResetAndDestroy();
	//create reminder 1
	TBuf8<255> buf;
	buf.Append(_L("GuidId_Reminder_1"));
	HBufC8* guid = buf.AllocLC();
	CCalEntry* reminder1 = CCalEntry::NewL(CCalEntry::EReminder, guid, CCalEntry::EMethodAdd, 0);
	CleanupStack::Pop(guid);
	iEntries.AppendL(reminder1);

	TCalTime starttime;
	starttime.SetTimeLocalL(TDateTime(2006, EMarch, 5, 0, 0, 0, 0));
	reminder1->SetStartAndEndTimeL(starttime, starttime);

	TBuf<50> summary;
	RandomText(summary);
	reminder1->SetSummaryL(summary);

	//create reminder 2
	buf.Delete(buf.Length()-1,1);
	buf.Append(2);
	guid = buf.AllocLC();
	CCalEntry* reminder2 = CCalEntry::NewL(CCalEntry::EReminder, guid, CCalEntry::EMethodAdd, 0);
	CleanupStack::Pop(guid);
	iEntries.AppendL(reminder2);
	starttime.SetTimeLocalL(TDateTime(2006, EMarch, 6, 0, 0, 0, 0));
	reminder2->SetStartAndEndTimeL(starttime, starttime);
	RandomText(summary);
	reminder2->SetSummaryL(summary);

	//create reminder 3
	buf.Delete(buf.Length()-1,1);
	buf.Append(3);
	guid = buf.AllocLC();
	CCalEntry* reminder3 = CCalEntry::NewL(CCalEntry::EReminder, guid, CCalEntry::EMethodAdd, 0);
	CleanupStack::Pop(guid);
	iEntries.AppendL(reminder3);
	starttime.SetTimeLocalL(TDateTime(2006, EMarch, 7, 0, 0, 0, 0));
	reminder3->SetStartAndEndTimeL(starttime, starttime);
	RandomText(summary);
	reminder3->SetSummaryL(summary);
	
	//Create appt
	buf.Zero();
	buf.Append(_L("GuidId_Appt"));
	guid = buf.AllocLC();
	CCalEntry* appt = CCalEntry::NewL(CCalEntry::EAppt, guid, CCalEntry::EMethodAdd, 0);
	CleanupStack::Pop(guid);
	iEntries.AppendL(appt);
	
	starttime.SetTimeLocalL(TDateTime(2006, EMarch, 7, 14, 0, 0, 0));
	TTime endtimetime(TDateTime(2006, EMarch, 7, 14, 0, 0, 0));
	endtimetime +=TTimeIntervalHours(1);
	TCalTime endtime;
	endtime.SetTimeLocalL(endtimetime);
	appt->SetStartAndEndTimeL(starttime, endtime);

	RandomText(summary);
	appt->SetSummaryL(summary);

//store 4 entries
	TInt entriesStored(0);
	SynCGetEntryViewL().StoreL(iEntries, entriesStored); 
	test(entriesStored == 4);
	iEntries.ResetAndDestroy();
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:71,代码来源:tcal_delete.cpp

示例10: AddEntryL

void CDummyCalendarApp::AddEntryL(TInt aNumToAdd, TBool isParent, TBool isRepeat)
	{
	test.Next(_L("Adding entries"));

	TBuf<50> summary;
	TBuf<50> location;
	TBuf<50> description;

    

	iEntries.ResetAndDestroy();
	for (TInt index=0; index<aNumToAdd; index++)
		{
		TBuf8<255> buf;
		buf.Append(_L("GuidId"));
		buf.AppendNum(index);
		HBufC8* guid = buf.AllocLC();   // need to be pushed to ...

		CCalEntry::TType entryType=(index%2==0)?CCalEntry::ETodo:CCalEntry::EAppt;

		CCalEntry* entry = NULL;
		if(isParent)
			{
			entry = CreateCalEntryL(entryType, guid);
			}
		else
			{
			TTime localTime(KRecurrIdLocalTime);
			TCalTime recurrenceId;
			recurrenceId.SetTimeLocalL(localTime);
			entry = CCalEntry::NewL(entryType, guid, CCalEntry::EMethodAdd, 1, recurrenceId, CalCommon::EThisAndFuture);
			}
		CleanupStack::Pop(guid);
		iEntries.AppendL(entry);

		TInt year = -1;
		TInt month = -1;
		TInt day = -1;
		
		if (isParent)
		    {
    		year = index % 5 + 2001;    // Any year in the range: 2001 - 2005
    		month = index % 12;         
    		day = index % 28;
		    }
        else
            {
            // if this is a child entry, use the recurrence local time as the entry start time 
            // so it won't be out of range
            TCalTime recurrId = entry->RecurrenceIdL(); 
            TDateTime localTime = recurrId.TimeLocalL().DateTime();               
            year = localTime.Year();
            month = localTime.Month();
            day = localTime.Day();    
            }
		
		TTime start(TDateTime(year, (TMonth)month, day, 0, 0, 0, 0));
		TTime end(TDateTime(year, (TMonth)month, day, 0, 0, 0, 0));
		end += TTimeIntervalDays(1);

		SetEntryStartAndEndTimeL(entry,start,end);
				
		RandomText(summary);
		entry->SetSummaryL(summary);
		
		RandomText(location);
		entry->SetLocationL(location);
		
		RandomText(description);
		entry->SetDescriptionL(description);

		if(isRepeat)
			{
			//create a daily repeat rule and make sure its repeat start\end date is within the deleting time range
			TCalRRule rpt(TCalRRule::EDaily);
			rpt.SetInterval(1);
			TCalTime repeatStart;
			TCalTime repeatend;
			if(isParent)
				{
				//make sure the repeat time is within the delete time range
				repeatStart.SetTimeLocalL(TDateTime(2000, EJune, 0, 0, 0, 0, 0));
				repeatend.SetTimeLocalL(TDateTime(2006, EJune, 0, 0, 0, 0, 0));
				}
			else if (index<aNumToAdd/2)
				{
                // if this is a child entry, use the entry's recurrance time as repeating rule
                // start time 
                TCalTime recurrId = entry->RecurrenceIdL(); 
				
				// make sure the repeat time is within the delete time range for the first half entries
				repeatStart.SetTimeLocalL(recurrId.TimeLocalL());	// June 1, 2003 00:00:00
				repeatend.SetTimeLocalL(recurrId.TimeLocalL() + TTimeIntervalMonths(1));  // July 1, 2003 00:00:00
				}
			else
				{
				//make sure the repeat time is out of the delete time range for the second half entries
				repeatStart.SetTimeLocalL(TDateTime(2003, EJune, 0, 0, 0, 0, 0));
				repeatend.SetTimeLocalL(TDateTime(2007, EJune, 0, 0, 0, 0, 0));
				}
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:101,代码来源:tcal_delete.cpp

示例11: DeleteWhileAnotherThreadAccessesCalendarL

void CDummyCalendarApp::DeleteWhileAnotherThreadAccessesCalendarL()
	{
	test.Printf(_L("Adding 1000 entries"));
	
	const TInt KNumEntriesToAdd(1000);
	
	for (TInt i(0) ; i < KNumEntriesToAdd ; ++i)
		{
		HBufC8* guid = NULL;
		CCalEntry* entry = CreateCalEntryL(CCalEntry::EAppt, guid);
		CleanupStack::PushL(entry);
		
		SetEntryStartAndEndTimeL(entry,
									TDateTime(2005, ESeptember, 12, 0, 0, 0, 0),
									TDateTime(2005, ESeptember, 12, 1, 0, 0, 0));
		
		RPointerArray<CCalEntry> entryArray;
		CleanupClosePushL(entryArray);
		
		entryArray.AppendL(entry);
		TInt num;
		SynCGetEntryViewL().StoreL(entryArray, num);
		
		CleanupStack::PopAndDestroy(&entryArray);
		CleanupStack::PopAndDestroy(entry);
		
		test.Printf(_L("."));
		}
	
	// start the second thread and wait for it to signal
	// that it is ready to recieve notifications
	RThread thread;
	CleanupClosePushL(thread);
	User::LeaveIfError(thread.Create(_L("SecondThread"), SecondThreadMain,
															KDefaultStackSize,
															KDefaultStackSize * 20, // this is the minimum heap size
															KDefaultStackSize * 40, // this is the maximum heap size
															NULL));
	thread.SetPriority(EPriorityMore);
	thread.Resume();
	
	// wait untill the second thread is ready
	TRequestStatus status;
	thread.Rendezvous(status);
	User::WaitForRequest(status);
		
	TCalTime start;
	start.SetTimeLocalL(TDateTime(2005, ESeptember, 0, 0, 0, 0, 0));
	TCalTime end;
	end.SetTimeLocalL(TDateTime(2006, EJanuary, 0, 0, 0, 0, 0));
	
	CalCommon::TCalTimeRange timeRange(start, end);
	
	CProgressCallBack* progress = new(ELeave) CProgressCallBack;
	CleanupStack::PushL(progress);
	
	test.Printf(_L("Start DeleteL\n"));
	SynCGetEntryViewL().DeleteL(timeRange, CalCommon::EIncludeAll, *progress);
	thread.Resume();
	// signal to the other thread that we have called delete
	// and it should start testing that the file is locked
	CActiveScheduler::Start();
	thread.Resume();
	
	CleanupStack::PopAndDestroy(progress);
	
	// Wait for the other thread to exit
	// and test that the exit reason was KErrNone
	thread.Logon(status);
	User::WaitForRequest(status);
	
	// If the other thread's testing was unsuccessful
	// the exit reason will be KErrGeneral
	test(status.Int() == KErrNone);
	
	CleanupStack::PopAndDestroy(&thread);
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:77,代码来源:tcal_delete.cpp

示例12: TestFileLockL

void CSecondThreadApp::TestFileLockL(TInt aError)
	{
	TCalTime from;
	from.SetTimeLocalL(TDateTime(2005, ESeptember, 11, 0, 0, 0, 0));
	TCalTime resultTime;
	
	// NextInstanceL
	RDebug::Printf("Test NextInstanceL");
	TInt error(KErrNone);
	TRAP(error, resultTime = iCalTestLib->SynCGetInstanceViewL().NextInstanceL(CalCommon::EIncludeAll, from));
	if (error != aError) 
		{
		User::Leave(KErrGeneral);
		}
	
	// PreviousInstanceL
	RDebug::Printf("Test PreviousInstanceL");
	error = KErrNone;
	TRAP(error, resultTime = iCalTestLib->SynCGetInstanceViewL().PreviousInstanceL(CalCommon::EIncludeAll, from));
	if (error != aError) 
		{
		User::Leave(KErrGeneral);
		}
	
	// GetIdsModifiedSinceDateL
	RDebug::Printf("Test GetIdsModifiedSinceDateL");
	RArray<TCalLocalUid> uids;
	CleanupClosePushL(uids);
	error = KErrNone;
	TRAP(error, iCalTestLib->SynCGetEntryViewL().GetIdsModifiedSinceDateL(from, uids));
	if (error != aError) 
		{
		User::Leave(KErrGeneral);
		}
	if (aError != KErrNone && uids.Count() != 0)
		{
		User::Leave(KErrGeneral);
		}
	CleanupStack::PopAndDestroy(&uids);
	
	// FindInstanceL
	RDebug::Printf("Test FindInstanceL");
	RPointerArray<CCalInstance> instanceList;
	CleanupResetAndDestroyPushL(instanceList);
	
	TCalTime start;
	start.SetTimeLocalL(TDateTime(2004, EMay, 12, 10, 30, 0, 0));
	TCalTime end;
	end.SetTimeLocalL(TDateTime(2007, EMay, 12, 10, 30, 0, 0));
	
	CalCommon::TCalTimeRange timeRange(start, end);
	
	error = KErrNone;
	TRAP(error, iCalTestLib->SynCGetInstanceViewL().FindInstanceL(instanceList, CalCommon::EIncludeAll, timeRange));
	if (error != aError)
		{
		User::Leave(KErrGeneral);
		}
	if (aError != KErrNone && instanceList.Count() != 0)
		{
		User::Leave(KErrGeneral);
		}
		
	CleanupStack::PopAndDestroy(&instanceList);
	
	// StoreL
	RPointerArray<CCalEntry> entryArray;
	CleanupResetAndDestroyPushL(entryArray);
	
	HBufC8* guid = NULL;
	CCalEntry* entry = iCalTestLib->CreateCalEntryL(CCalEntry::EAppt, guid);
	CleanupStack::PushL(entry);
	iCalTestLib->SetEntryStartAndEndTimeL(entry, TDateTime(2005, EMay, 23, 10, 30, 0, 0),
													TDateTime(2005, EMay, 23, 11, 0, 0, 0));
	entryArray.AppendL(entry);
	CleanupStack::Pop(entry);
	TInt numSuc;
	error = KErrNone;
	TRAP(error, iCalTestLib->SynCGetEntryViewL().StoreL(entryArray, numSuc));
	if (error != aError)
		{
		User::Leave(KErrGeneral);
		}
	
	// UpdateL
	error = KErrNone;
	TRAP(error, iCalTestLib->SynCGetEntryViewL().UpdateL(entryArray, numSuc));
	if (error != aError && error != KErrNotFound)
		{
		User::Leave(KErrGeneral);
		}
	// FetchL
	error = KErrNone;
	TRAP(error, iCalTestLib->SynCGetEntryViewL().FetchL(*guid, entryArray));
	if (error != aError)
		{
		User::Leave(KErrGeneral);
		}
		
	// DeleteL
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:101,代码来源:tcal_delete.cpp

示例13: DeleteEntriesByTimeRangeL

/**
* Delete entries in the calendar file over a wider time Range
*/
void CTestCalInterimApiModifier::DeleteEntriesByTimeRangeL()
	{
	TPtrC timeMode;
	GetStringFromConfig(ConfigSection(), KFilterTimeMode, timeMode);

	TPtrC deleteFilterStartTime;
	GetStringFromConfig(ConfigSection(), KDeleteFilterStartTime, deleteFilterStartTime);
	TCalTime	calStartDateTime;

	if(deleteFilterStartTime != KNullDesC())
		{
		// Convert TPtrC to TTime
		TTime	startTTime;
		startTTime.Set(deleteFilterStartTime);

		if(!timeMode.Compare(KFilterTimeModeLocal))
			{
			calStartDateTime.SetTimeLocalL(startTTime);
			}
		else if (!timeMode.Compare(KFilterTimeModeLocalFloating))
			{
			calStartDateTime.SetTimeLocalFloatingL(startTTime);
			}
		else
			{
			calStartDateTime.SetTimeUtcL(startTTime);
			}
		}
	else
		{
		calStartDateTime.SetTimeLocalL(TCalTime::MinTime());
		}


	TCalTime	calEndDateTime;
	TPtrC  deleteFilterEndTime;
	GetStringFromConfig(ConfigSection(), KDeleteFilterEndTime, deleteFilterEndTime);

	if(deleteFilterEndTime != KNullDesC())
		{
		// Convert TPtrC to TTime
		TTime	endTTime;
		endTTime.Set(deleteFilterEndTime);

		if(!timeMode.Compare(KFilterTimeModeLocal))
			{
			calEndDateTime.SetTimeLocalL(endTTime);
			}
		else if (!timeMode.Compare(KFilterTimeModeLocalFloating))
			{
			calEndDateTime.SetTimeLocalFloatingL(endTTime);
			}
		else
			{
			calEndDateTime.SetTimeUtcL(endTTime);
			}
		}
	else
		{
		calEndDateTime.SetTimeLocalL(TCalTime::MaxTime());
		}

	CalCommon::TCalTimeRange	calTimeRange(calStartDateTime, calEndDateTime);
	TRAPD(err, iEntryView->DeleteL(calTimeRange, CalCommon::EIncludeAll, *this));
	CActiveScheduler::Start();

	if(err != KErrNone)
		{
		iTestStep->ERR_PRINTF2(KErrDeleteOperation,err);
		iTestStep->SetTestStepResult(EFail);
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:75,代码来源:TestCalInterimApiModifier.cpp

示例14: test

void CAppActive2::RunL()
	{
	RTest test(KTestName);
	iCount++;
	switch (iStep)
		{
		case EStepCreateView:
			{
		// Step 1
		// 1. Open the existing file which is created by the main thread
		// 2. Create a view which result in building indexes
		// 3. For the first few times, iStep is set to step 2 so that the building index process is started and cancelled repeatedly.
		// Later on, the iStep is set to step 3 and wait for the index building is completed.
			if(iCancelBuildIndex)
				{
				test(iApp->Status()==CMultiThreadTestApp2::EBuildIndexCancel);
				}
			iApp->OpenFileL(KTestFile);
			iApp->GetSession().OpenL(KTestFile);
			iStep = EStepMutipleOperation1;
			iInstanceView = CCalInstanceView::NewL(iApp->GetSession(), *iApp);
			if(iCount<50)
				{//Test that both threads build index and cancel it spotenously
				iStep = EStepDeleteView;			
				Start();
				}
			}
			break;
		case EStepDeleteView:
			{
		// Step 2
		// Delete the view which result in cancelling the index building
			iCancelBuildIndex = ETrue;
			delete iInstanceView;
			iInstanceView=NULL;
			iStep = EStepCreateView;
			}
			break;
		case EStepMutipleOperation1:
			{
			//Step 3
			//The other thread cancel the building index request which shouldn't affect the server to build index for this thread
			// Test the index is built and it is able to use it to find instances.

			test(iApp->Status()==CMultiThreadTestApp2::EBuildIndexComplete);
			RPointerArray<CCalInstance>instArray;
			CleanupResetAndDestroyPushL(instArray);
			TCalTime calStartTime;
			TCalTime calEndTime;
			calStartTime.SetTimeLocalL(TCalTime::MinTime());
			calEndTime.SetTimeLocalL(TCalTime::MaxTime());
			CalCommon::TCalTimeRange timeRange(calStartTime, calEndTime);
			iInstanceView->FindInstanceL(instArray, CalCommon::EIncludeAll, timeRange);
			test(instArray.Count() == KNumberOfEntriesToAdd); 
			CleanupStack::PopAndDestroy(&instArray); 
			
			// Wait for the first thread is ready to make sure operations are carried spontaneously
			// (Synch Point 1)
			iApp->SynchWithOtherThread();
			iEntryView = CCalEntryView::NewL(iApp->GetSession());
			iApp->AddEntryL(*iEntryView, KNumberOfEntriesToAdd);
			
			// (Synch Point 2)
			iApp->SynchWithOtherThread();
			RPointerArray<CCalEntry> entries;
			CleanupResetAndDestroyPushL(entries);
			iApp->FetchEntryL(*iEntryView, entries);
			CleanupStack::PopAndDestroy(&entries);
			
			// (Synch Point 3)
			iApp->SynchWithOtherThread();
			TRAPD(err,iApp->AddEntryL(*iEntryView,KNumberOfEntriesToAdd));	
			test.Printf(_L("Synch Point 3 err is: %d\n"),err);
			test(err==KErrLocked || err == KErrNone);
			// (Synch Point 4)
			iApp->SynchWithOtherThread();
			iApp->SetStatus(CMultiThreadTestApp::ESynchentry);
			iApp->SynchEntryL(*iEntryView);
			iStep = EEnd;
			break;
			}
		case EEnd:
			{
			iApp->Close();
			}
			break;
		default:
			User::Leave(KErrNotFound);
		}
	test.Close();
	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:91,代码来源:tcal_multi_threads_access.cpp

示例15: writeStream

TVerdict CTestCalInterimApiDEF064928Step::doTestStepL()
	{
	CActiveScheduler* scheduler = new(ELeave)CActiveScheduler;
	CleanupStack::PushL(scheduler);  
	CActiveScheduler::Install(scheduler);

	iSession  = CCalSession::NewL();
	
	CTestCalInterimApiCallbackForAlarms* alarmCallback = CTestCalInterimApiCallbackForAlarms::NewL(this);
	CleanupStack::PushL(alarmCallback); 

	OpenSessionFileL();
	iEntryView = CCalEntryView::NewL(*iSession,*alarmCallback);
	
	SetTestStepResult(EFail);
	
	CActiveScheduler::Add(alarmCallback);
	CActiveScheduler::Start();
	
	TUint seqNo = 1;
	HBufC8* pGUID1= KAlarmExportTestGUID1().AllocLC();
	CCalEntry* entry1 = CCalEntry::NewL(CCalEntry::EAppt, pGUID1,
	                                    CCalEntry::EMethodAdd, seqNo);
	CleanupStack::Pop(pGUID1); // entry takes ownership
	CleanupStack::PushL(entry1);                                   

	TDateTime entryStart1(2006, EJuly, 6, 15, 0, 0, 0);
	TCalTime  calStart1;
	calStart1.SetTimeLocalL(entryStart1);
	TDateTime entryStop1(2006, EJuly, 6, 16, 0, 0, 0);
	TCalTime calStop1;
	calStop1.SetTimeLocalL(entryStop1);
	entry1->SetStartAndEndTimeL(calStart1, calStop1);

	TCalRRule* rpt = new (ELeave) TCalRRule(TCalRRule::EDaily);
	CleanupStack::PushL(rpt); 

	rpt->SetInterval(1);
	TCalTime startTime;
	startTime.SetTimeLocalL(TDateTime(2006, EJuly, 6, 0, 0, 0, 0));
	rpt->SetDtStart(startTime);
	TCalTime endTime;
	endTime.SetTimeLocalL(TDateTime(2006, EJuly, 10, 0, 0, 0, 0));
	rpt->SetUntil(endTime);
	entry1->SetRRuleL(*rpt); // doesn't take ownership

	CleanupStack::PopAndDestroy(rpt); 
	
	SaveToAgendaL(entry1, EFalse);

	seqNo++;
	HBufC8* pGUID2= KAlarmExportTestGUID2().AllocLC();
	TDateTime entryTime2(2006, EJuly, 9, 15, 0, 0, 0);
	TCalTime  calTime2;
	calTime2.SetTimeLocalL(entryTime2);
	CCalEntry* entry2 = CCalEntry::NewL(CCalEntry::EAppt, pGUID2,
	                                    CCalEntry::EMethodAdd, seqNo, calTime2, 
	                                    CalCommon::EThisOnly);
	CleanupStack::Pop(pGUID2); // entry takes ownership
	CleanupStack::PushL(entry2);                                   

	CreateExceptionDateL(entry2, entry1);

	RArray<TCalTime> exDateList1;
	CleanupClosePushL(exDateList1);
	entry1->GetExceptionDatesL(exDateList1);
	TESTL(exDateList1[0].TimeLocalL() == calTime2.TimeLocalL());
	CleanupStack::PopAndDestroy();

	//build the CCalDataExchange object and Export
	RFs   fs;
	fs.Connect();
	CleanupClosePushL(fs);
	
	CCalDataExchange* dataExchange = CCalDataExchange::NewL(*iSession);
	CleanupStack::PushL(dataExchange); 
	RFile outFile;
	CleanupClosePushL(outFile);
	TInt err = outFile.Replace(fs, KEntryExportFile, EFileWrite);
	RFileWriteStream writeStream(outFile);
	CleanupClosePushL(writeStream);
	
	INFO_PRINTF1(KExporting);
	RPointerArray<CCalEntry> firstEntryArray;
	CleanupStack::PushL(TCleanupItem(CloseAndDeleteRPtrArrayEntries, &firstEntryArray));
	iEntryView->FetchL(entry1->UidL(), firstEntryArray);
		
	dataExchange->ExportL(KUidVCalendar, writeStream, firstEntryArray);
	
	writeStream.CommitL();
	
	// check that the exception date was stored correctly
	CCalEntry *fetchedEntry = firstEntryArray[0];
	RArray<TCalTime> exDateList2;
	fetchedEntry->GetExceptionDatesL(exDateList2);
	CleanupClosePushL(exDateList2);
	TESTL(exDateList2[0].TimeLocalL() == calTime2.TimeLocalL());
	
	CleanupStack::PopAndDestroy();
	CleanupStack::PopAndDestroy();
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:101,代码来源:TestCalInterimApiExceptionStep.cpp


注:本文中的TCalTime::SetTimeLocalL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。