コード例 #1
0
// -----------------------------------------------------------------------------
// RDRMRightsClient::ExportContentIDList
// Overloaded method: requests all content IDs to be put to a file,
// and then converts the file into RPointerArray.
// -----------------------------------------------------------------------------
//
EXPORT_C TInt RDRMRightsClient::ExportContentIDList( RPointerArray< HBufC8 >& aCIDList )
    {
    DRMLOG( _L( "RDRMRightsClient::ExportContentIDList to array" ) );
    TFileName name;
    aCIDList.ResetAndDestroy();

    TInt error = ExportContentIDList( name );
    if ( !error )
        {
        RFs fs;
        error = fs.Connect();
        if ( !error )
            {
            TRAP( error, URIFileToArrayL( fs, name, aCIDList ) );
            if ( error )
                {
                aCIDList.ResetAndDestroy();
                }

            fs.Delete( name );
            fs.Close();
            }
        }

    DRMLOG2( _L( "RDRMRightsClient::ExportContentIDList: %d" ), error );

    return error;
    }
コード例 #2
0
void CCalAlarmAttachTest::TestFetchEntryAlarmContentL()
    {
    test.Printf(_L("Test fetching entry twice and check it alarm conten\n"));
    _LIT8(KEntryUidFetchEntry, "FetchEntryUid");
    CCalAlarm* alarm = StoreEntryWithAlarmContentLC(KEntryUidFetchEntry());
    RPointerArray<CCalEntry> entries;
    CleanupResetAndDestroyPushL(entries);

    //Fetch the entry and test the alarm  content
    iTestLib->SynCGetEntryViewL().FetchL(KEntryUidFetchEntry(), entries);
    TInt entriesStored = 0;
    iTestLib->SynCGetEntryViewL().StoreL(entries, entriesStored);
    entries.ResetAndDestroy();
    iTestLib->SynCGetEntryViewL().FetchL(KEntryUidFetchEntry(), entries);
    CCalEntry* entry = entries[0];
    test( KSummary() == entry->SummaryL() );
    test( KDescription() == entry->DescriptionL());
    TestAlarmL(entry, KContent(), KMimeType());
    entries.ResetAndDestroy();

    //Close the serve and fetch the entry again
    iTestLib->CloseAgendaServer();
    iTestLib->OpenFileL(KCalName());

    iTestLib->SynCGetEntryViewL().FetchL(KEntryUidFetchEntry(), entries);
    TestAlarmL(entries[0], KContent(), KMimeType());
    CleanupStack::PopAndDestroy(&entries);
    CleanupStack::PopAndDestroy(alarm);
    }
コード例 #3
0
void CScrGetComponentLocalizedStep::ImplTestStepL()
    {
    TComponentId expectedComponentId = GetComponentIdL();
    RPointerArray<Usif::CLocalizableComponentInfo> compLocalizedInfoArrayExpected;
    CleanupResetAndDestroyPushL(compLocalizedInfoArrayExpected);
    
    GetLocalisedComponentsFromConfigL(compLocalizedInfoArrayExpected);
    
    RPointerArray<Usif::CLocalizableComponentInfo> compLocalizedInfoArrayRetrieved;
    // Start timer just before invocation of SCR API
    StartTimer();
    CleanupResetAndDestroyPushL(compLocalizedInfoArrayRetrieved);
    iScrSession.GetComponentLocalizedInfoL(expectedComponentId, compLocalizedInfoArrayRetrieved);
    if(compLocalizedInfoArrayExpected.Count()!=compLocalizedInfoArrayRetrieved.Count())
        {
        ERR_PRINTF1(_L("Returned component entry count doesnt match the expected count")); 
        SetTestStepResult(EFail);
        }
    else
        {
        for(TInt i=0;i<compLocalizedInfoArrayExpected.Count();i++)
            {
            if((compLocalizedInfoArrayExpected[i]->NameL()!=compLocalizedInfoArrayExpected[i]->NameL())||(compLocalizedInfoArrayExpected[i]->VendorL()!=compLocalizedInfoArrayExpected[i]->VendorL())||(compLocalizedInfoArrayExpected[i]->Locale()!=compLocalizedInfoArrayExpected[i]->Locale()))
                {
                ERR_PRINTF7(_L("Returned component entry values(%S,%S,%d) don't match with the expected ones(%S,%S,%d)."),&(compLocalizedInfoArrayRetrieved[i]->NameL()),&(compLocalizedInfoArrayRetrieved[i]->VendorL()),compLocalizedInfoArrayRetrieved[i]->Locale(),&(compLocalizedInfoArrayExpected[i]->NameL()),&(compLocalizedInfoArrayExpected[i]->VendorL()),compLocalizedInfoArrayExpected[i]->Locale());
                SetTestStepResult(EFail);
                }
            }
        }           
        
    CleanupStack::Pop(2,&compLocalizedInfoArrayExpected); //compLocalizedInfoArrayExpected ,compLocalizedInfoArrayRetrieved 
    compLocalizedInfoArrayRetrieved.ResetAndDestroy();
    compLocalizedInfoArrayExpected.ResetAndDestroy();
    }
コード例 #4
0
// -----------------------------------------------------------------------------
// ReadArrayFromStringL
// Reads the array from the string
// -----------------------------------------------------------------------------
//
LOCAL_C void ReadArrayFromStringL( const TDesC8& aString,
                                   RPointerArray<HBufC8>& aArray )
    {
    RMemReadStream inRead( static_cast<const TAny*>( aString.Ptr() ), aString.Size() );
    TInt size = 0;
    HBufC8* addData = NULL;
    TPtr8 dataBuffer(NULL,0,0);
    CleanupClosePushL( inRead );


    aArray.ResetAndDestroy();


    for( TInt i = 0; i < aString.Size();)
        {
        // If there is not enough data to read the integer
        // it means that it's an old version and the whole thing is the
        // string since in previous versions only one string is stored
        if(( aString.Size() - i) < sizeof(TInt) )
            {
            aArray.ResetAndDestroy();
            addData = aString.AllocLC();
            aArray.AppendL( addData );
            CleanupStack::Pop();
            CleanupStack::PopAndDestroy(); // inRead
            return;
            }

        size = inRead.ReadInt32L();
        i += sizeof(TInt);

        // If the size is negative or the size left is not large enough
        // it means that it's an old version and the whole thing is the
        // string since in previous versions only one string is stored.
        if( size < 0 || size > ( aString.Size() - i ) )
            {
            aArray.ResetAndDestroy();
            addData = aString.AllocLC();
            aArray.AppendL( addData );
            CleanupStack::Pop();
            CleanupStack::PopAndDestroy(); // inRead
            return;
            }
        addData = HBufC8::NewMaxLC( size );

        // Set the read buffer:
        dataBuffer.Set(const_cast<TUint8*>(addData->Ptr()), 0, size);

        // Read the data:
        inRead.ReadL( dataBuffer );

        aArray.AppendL( addData );
        CleanupStack::Pop( addData );

        i += size;
        }
    CleanupStack::PopAndDestroy();
    return;
    }
コード例 #5
0
void CScrReadUserDataSecTest::RunTestL()
	{
	RSoftwareComponentRegistry scrSession;
	User::LeaveIfError(scrSession.Connect());
	CleanupClosePushL(scrSession);

	TInt err(0);
	TComponentId testComponentId(1);
	// Check subsession APIs
	CComponentFilter* componentFilter = CComponentFilter::NewLC();

	RSoftwareComponentRegistryView compRegistryView;
	TRAP(err, compRegistryView.OpenViewL(scrSession, componentFilter));
	CheckFailL(err, _L("CComponentFilter::OpenViewL"));
	if (err == KErrNone)
		{
		// In a negative test, we should fail opening a sub-session. In this case we cannot continue with NextComponentL
		TRAP(err, compRegistryView.NextComponentL());
		CheckFailL(err, _L("CComponentFilter::NextComponentL"));		
		compRegistryView.Close();
		}

	RArray<TComponentId> componentIds;
	TRAP(err, scrSession.GetComponentIdsL(componentIds));
	if(KErrNone==err && componentIds.Count()!=0)
	    testComponentId=componentIds[0];       //The testComponentId retrieved, is used in the subsequent tests to get its localized information
	CleanupClosePushL(componentIds);
	CheckFailL(err, _L("RSoftwareComponentRegistry::GetComponentIdsL"));

	RPointerArray<Usif::CLocalizableComponentInfo> compLocalizedInfoArray;
	CleanupResetAndDestroyPushL(compLocalizedInfoArray);
	TRAP(err, scrSession.GetComponentLocalizedInfoL(testComponentId, compLocalizedInfoArray));
	CheckFailL(err, _L("RSoftwareComponentRegistry::GetComponentLocalizedInfoL"));
	CleanupStack::Pop(&compLocalizedInfoArray);
	compLocalizedInfoArray.ResetAndDestroy();
	
	
	RArray<TLanguage> matchingSupportedLanguages;
	CleanupClosePushL(matchingSupportedLanguages);
	TRAP(err, scrSession.GetComponentSupportedLocalesListL(testComponentId, matchingSupportedLanguages));
	CheckFailL(err, _L("RSoftwareComponentRegistry::GetComponentSupportedLocalesListL"));
    CleanupStack::PopAndDestroy(&matchingSupportedLanguages);
	
	RPointerArray<CScrLogEntry> logEntries;
	TRAP(err, scrSession.RetrieveLogEntriesL(logEntries));
	logEntries.ResetAndDestroy();
	CheckFailL(err, _L("RSoftwareComponentRegistry::RetrieveLogEntriesL"));
		
	CleanupStack::PopAndDestroy(2, componentFilter); // componentIds,  componentFilter  

	CleanupStack::PopAndDestroy(&scrSession);
	}
コード例 #6
0
void FmBkupEnginePrivate::ResetAndDestroyArchives( TAny* aPtr )
    {
    RPointerArray< CMMCScBkupArchiveInfo >* archive = 
        static_cast< RPointerArray< CMMCScBkupArchiveInfo >* >( aPtr );
    archive->ResetAndDestroy();
    archive->Close();
    }
コード例 #7
0
void CNSmlDummyDataProvider_Test::DoSupportedServerFiltersL()
    {
    RPointerArray< CSyncMLFilter > filterArray;
    filterArray = iCNSmlDummyDataProvider->DoSupportedServerFiltersL();
    filterArray.ResetAndDestroy();
    filterArray.Close();
    }
コード例 #8
0
/**
Delete user-defined time zones.

@SYMTestCaseID 	PIM-APPSERV-TZS-CO-0003

@SYMTestCaseDesc
	The purpose of this test is to verify that user-defined time zones can be
	deleted.

@SYMTestActions  
	1.	Get all existing user-defined time zones.
	2.	Delete the user-defined time zone as the last element in the array one
		by one.
	3.	Try to read the user-defined time zone deleted in action 2.

@SYMTestExpectedResults
	The user-defined time zone does not exist.

@SYMTestType
	CT

@SYMTestPriority
	1
*/
void CTzUserDataTest::TestDeleteUserDefinedTzL()	
	{
	test.Next(_L("@SYMTestCaseID  PIM-APPSERV-TZS-CO-0003"));
	RPointerArray<CTzId> ids;
	CleanupStack::PushL(TCleanupItem(ResetAndDestroyTzIdArray, &ids));

	for(TInt ii=iTzIds.Count()-1; ii>=0; --ii)
		{
		iUserData->GetTzIdsL(ids);
		
		// The array obtained should be same as expected who elements is deleted
		// one by one in each loop.
		CompareArray(ids,iTzIds);
		ids.ResetAndDestroy();
		
		// Delete the user-defined time zone as the last element in the array.
		iUserData->DeleteL(*(iTzIds[ii]));
		
		// The rule and names of the last element in the array should not be
		// found since it has been deleted.
		TRAPD(err, iUserData->ReadRulesL(*(iTzIds[ii])));
		test(err == KErrNotFound);
		TRAP(err, iUserData->ReadNamesL(*(iTzIds[ii])));
		test(err == KErrNotFound);

		delete iTzIds[ii];
		iTzIds.Remove(ii);
		}

	CleanupStack::PopAndDestroy(&ids);
	}
コード例 #9
0
// -----------------------------------------------------------------------------
// RDRMRightsClient::GetDBEntriesL
// Get a file name from the server. The file contains the rights objects,
// which are then converted to RPointerArray.
// -----------------------------------------------------------------------------
//
EXPORT_C void RDRMRightsClient::GetDBEntriesL( const TDesC8& aId,
                                      RPointerArray< CDRMPermission >& aRightsList )
    {
    DRMLOG( _L( "RDRMRightsClient::GetDBEntries" ) );
    if( aId.Length() )
        {
        // Temporary file name from the server.
        TDRMFileDeletion item;

        // Make sure that the array is empty.
        aRightsList.ResetAndDestroy();

        // For file operations. Destructor of TDRMFileDeletion
        // deletes the file & closes the session.
        User::LeaveIfError( item.iFs.Connect() );

        User::LeaveIfError( SendReceive( DRMEngine::EGetEntryList,
                                         TIpcArgs( &item.iName, &aId ) ) );

        // Convert the file to a list.
        FileToListL( item.iFs, item.iName, aRightsList );

        DRMLOG( _L( "RDRMRightsClient::GetDBEntries ok" ) );

        return;
        }

    // Invalid parameter.
    User::Leave( KErrArgument );
    }
コード例 #10
0
ファイル: MsgDataBase.cpp プロジェクト: DrJukka/Symbian_Codes
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/ 
void CScheduleDB::ReadDbItemsL(RPointerArray<CMsgStored>& aItemArray)
{
	aItemArray.ResetAndDestroy();// first reset the array
	
	TFileName QueryBuffer;
	QueryBuffer.Copy(_L("SELECT * FROM "));// just get all columns & rows
	QueryBuffer.Append(KtxtItemlist2);
		
	RDbView Myview;
	Myview.Prepare(iItemsDatabase,TDbQuery(QueryBuffer));
	CleanupClosePushL(Myview);
	Myview.EvaluateAll();
	Myview.FirstL();
	
	while(Myview.AtRow()) // Just delete one instance of the message           
	{	
		Myview.GetL();		
		
		CMsgStored* NewItem = new(ELeave)CMsgStored();	
		aItemArray.Append(NewItem);
		
		NewItem->iIndex = Myview.ColInt32(1);
		NewItem->iMessage = Myview.ColDes(2).AllocL();
				
		Myview.NextL();
	} 
	
	CleanupStack::PopAndDestroy(1); // Myview
}
コード例 #11
0
// ==========================================================================
// FUNCTION: IsSameSearchCriteriaL
// ==========================================================================
TBool CContainerStoreSearchHandler::IsSameSearchCriteriaL( RPointerArray<HBufC>& aSearchStrings )
    {
    //
    RPointerArray<HBufC> newSearchPatterns;
    
    CreateSearchPatternL( aSearchStrings, newSearchPatterns );
    
    TBool isSame = newSearchPatterns.Count() == iSearchStrings.Count();
    
    if ( isSame )
        {
        for ( TInt i = 0 ; i < iSearchStrings.Count() ; i++ )
            {
            isSame = newSearchPatterns[i]->CompareC( *(iSearchStrings[i]) ) == 0;
            if ( !isSame )
                {
                break;
                }
            }
        }
    
    newSearchPatterns.ResetAndDestroy();
    
    return isSame;
    }
コード例 #12
0
void CDummyCalendarApp::RepeatExceptedEntryEditInstancesL(
    RPointerArray<CCalInstance>& aInstances )
	{
	CleanupResetAndDestroyPushL(aInstances);	
	
	// Delete all entries.
	iEntries.ResetAndDestroy();
	
	TTime start(TDateTime(2006, EMarch, 6, 10, 0, 0, 0));
	TTime end(TDateTime(2006, EMarch, 6, 14, 0, 0, 0));	
	
	// Re-create all the entries that previously existed.
	CCalEntry* entry = NULL;
	for (TUint i = 0; i < aInstances.Count(); ++i)
		{
		HBufC8* guid = KGUIDInc081869().AllocLC();	
		entry = CCalEntry::NewL( CCalEntry::EAppt, guid, CCalEntry::EMethodAdd,
		    i, aInstances[i]->Time(), CalCommon::EThisOnly );
		CleanupStack::Pop( guid );
		iEntries.AppendL( entry );
		
		SetEntryStartAndEndTimeL(entry, start, end);		
		}
	
	CleanupStack::PopAndDestroy(&aInstances);
	
	// Store the entries again, there should be 2.
	TInt entriesStored = 0;
	SynCGetEntryViewL().StoreL(iEntries, entriesStored);
	test(entriesStored == iEntries.Count());
	}
コード例 #13
0
// ----------------------------------------------------------
// CSimplePresenceList::ResetAndDestroy
// ----------------------------------------------------------
//
void CSimplePresenceList::ResetAndDestroy( TAny* aPtrArray )
    {
    RPointerArray<CBodyPart>* array =
    	static_cast<RPointerArray<CBodyPart>*>( aPtrArray );
    array->ResetAndDestroy();
    array->Close();	
    }    
コード例 #14
0
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
	}
コード例 #15
0
/** function used to create the linked typefaces
 */
void CTLinkedTypefaceCreator::CreateL()
	{
	CFbsTypefaceStore* store = CFbsTypefaceStore::NewL(iDev);
	CleanupStack::PushL(store);

	for (TInt counter=0; counter< sizeof(KLinkedTypefaces)/sizeof(TTLinkedTypeface);counter++)
		{
		//creating the groups needs to be done for every typeface since ownwership is taken
		//after adding the group to one linked typeface specification
		//leave on any failure e.g. out of memory, which is not expected
		CreateGroupsL(KGroupList, sizeof(KGroupList)/sizeof(TTGroup*));

		//create the linked typeface elements for this linked typeface
		CreateElementsL(KLinkedTypefaces[counter].iElements);

		//add the groups and elements, but first create the spec
		CLinkedTypefaceSpecification* spec = CLinkedTypefaceSpecification::NewLC(KLinkedTypefaces[counter].iTypefaceName);
		
		//add the groups
		for (TInt groupCounter=0; groupCounter<iGroups.Count();groupCounter++)
			{
			spec->AddLinkedTypefaceGroupL(*iGroups[groupCounter]);//ownership is taken
			iGroups[groupCounter]=NULL;
			}

		//add the elements
		for (TInt elementCounter=0; elementCounter<iElements.Count();elementCounter++)
			{
			spec->AddTypefaceAtBackL(*iElements[elementCounter]);//ownership is taken
			iElements[elementCounter]=NULL;
			}
		iElements.ResetAndDestroy();
		iGroups.ResetAndDestroy();

		//register
		TInt err=KErrNone;
		TRAP(err,spec->RegisterLinkedTypefaceL(*store)); //may fail if something is wrong with the tables, want to try to continue

		//do not report test failure if already registered
		iStep->testBooleanTrue(err==KErrNone || err==KErrAlreadyExists, (TText8*)__FILE__, __LINE__);

		//delete spec
		CleanupStack::PopAndDestroy();
		}
	CleanupStack::PopAndDestroy();//store
	}
コード例 #16
0
LOCAL_D void ResetAndDestroyTzIdArray(TAny* aPtr)
	{
	RPointerArray<CTzId>* ids = static_cast<RPointerArray<CTzId>*>(aPtr);
	if (ids)
		{
		ids->ResetAndDestroy();
		}
	}
コード例 #17
0
static void ResetAndDestroyCalEntryArray(TAny* aPtr)
	{
	if (aPtr)
		{
		RPointerArray<CCalEntry>* array = static_cast<RPointerArray<CCalEntry>*>(aPtr);
		array->ResetAndDestroy();
		}
	}
コード例 #18
0
static void CleanupCCalEntryArray(TAny* aPointer)
	{
	RPointerArray<CCalEntry>* calEntryArray = static_cast<RPointerArray<CCalEntry>*>(aPointer); 
	if (calEntryArray)
		{
		calEntryArray->ResetAndDestroy();
		}
	}
コード例 #19
0
// -----------------------------------------------------------------------------
// CFSMailMessage::AttachmentListL
// -----------------------------------------------------------------------------
EXPORT_C void CFSMailMessage::AttachmentListL(
    RPointerArray<CFSMailMessagePart>& aParts )
    {
    // First list all message parts
    AppendAttachmentsL( aParts );
    
    NM_FUNCTION;
    
    // special case, if single part content type is not given,
    // default type is text/plain
    if ( aParts.Count() == 1 && aParts[0]->GetContentType().Length() == 0)
        {
        aParts.ResetAndDestroy();
        }
    else
        {
        // find plain text body part from the list
        CFSMailMessagePart* txtPart = FindBodyPartL(KFSMailContentTypeTextPlain);
        CleanupStack::PushL( txtPart );
        if ( txtPart
          && txtPart->AttachmentNameL().Length() == 0 ) // real attachments have names
            {
            // remove plain text body part from attachment list
            for ( TInt ii = aParts.Count() - 1; ii >= 0; --ii )
                {
                if ( aParts[ii]->GetPartId() == txtPart->GetPartId() )
                    {
                    delete aParts[ii];
                    aParts.Remove(ii);
                    break;
                    }
                }
            }
        CleanupStack::PopAndDestroy( txtPart );

        // find  html body part from the list
        CFSMailMessagePart* htmlPart = FindBodyPartL(KFSMailContentTypeTextHtml);
        CleanupStack::PushL( htmlPart );
        if ( htmlPart
          && htmlPart->AttachmentNameL().Length() == 0 ) // real attachments have names
            {
            // remove html body part from attachment list
            for ( TInt ii = aParts.Count() - 1; ii >= 0; --ii )
                {
                if ( aParts[ii]->GetPartId() == htmlPart->GetPartId() )
                    {
                    delete aParts[ii];
                    aParts.Remove(ii);
                    break;
                    }
                }
            }
        CleanupStack::PopAndDestroy( htmlPart );
        }

    iMessageParts.ResetAndDestroy();
    iReadMessageParts = ETrue;
    }
コード例 #20
0
// -----------------------------------------------------------------------------
// CSipAcceptContactStrategy::DestroyFeatureSets
// -----------------------------------------------------------------------------
//
void CSipAcceptContactStrategy::DestroyFeatureSets(TAny* aFeatureSets)
	{
    RPointerArray<CSIPFeatureSet>* featureSets =
        reinterpret_cast<RPointerArray<CSIPFeatureSet>*>(aFeatureSets);
    if (featureSets)
        {
        featureSets->ResetAndDestroy();
        }
	}
コード例 #21
0
// -----------------------------------------------------------------------------
// CSIPHeaderBase::ResetAndDestroy
// -----------------------------------------------------------------------------
//
void CSIPHeaderBase::ResetAndDestroy(TAny* anArray)
	{
    RPointerArray<CSIPHeaderBase>* array =
        reinterpret_cast<RPointerArray<CSIPHeaderBase>*>(anArray);
    if (array)
        {
        array->ResetAndDestroy();
        }
	}
コード例 #22
0
void CTzUserData::CleanupPointerArray(TAny* aArray)
    {
    RPointerArray<CTzId>* array = static_cast<RPointerArray<CTzId>* >(aArray);
    if (array)
        {
        array->ResetAndDestroy();
        array->Close();
        }
    }
コード例 #23
0
void CDummyCalendarApp::AddFloatingEntryWithMinStartTimeL()
	{//Defect fix for PDEF111562  - when a floating entry with miniman start time will never get deleted.
	iEntries.ResetAndDestroy();

	_LIT8(KUid, "UID_MinEntry");
	HBufC8* guid = KUid().AllocLC();
	CCalEntry* entry = iTestLib->CreateCalEntryL(CCalEntry::EReminder, guid);
	CleanupStack::Pop(guid);
	CleanupStack::PushL(entry);
	TCalTime caltimestart,caltimeend;
	TTime min(TDateTime(1900, EJanuary, 0, 0, 0, 0, 0));
	caltimestart.SetTimeLocalFloatingL(min);
	entry->SetStartAndEndTimeL(caltimestart,caltimestart);
	iEntries.AppendL(entry);
	CleanupStack::Pop(entry);
	TInt entriesStored(0);
	SynCGetEntryViewL().StoreL(iEntries, entriesStored); //temp
	iEntries.ResetAndDestroy();	
	}
コード例 #24
0
// ----------------------------------------------------------------------------
// CSIPClientResolver::ResetAndDestroy
// ----------------------------------------------------------------------------
//
void CSIPClientResolver::ResetAndDestroy( TAny* anArray )
    {
    RPointerArray< CSIPClientData >* array =
        reinterpret_cast<RPointerArray< CSIPClientData >*>( anArray );
    if (array)
        {
        array->ResetAndDestroy();
        delete array;
        }
    }
コード例 #25
0
void CHTTPSession::ListAvailableProtocolsL(RPointerArray<HBufC8>& aProtocolArray)
	{
	// Delete existing data from protocol array
	aProtocolArray.ResetAndDestroy();

	// Query ECom for available protocols, need to use TCleanupItem as array is not cleaned
	// up by ECom if a leave occurs
	RImplInfoPtrArray availableEComProtocols;
	TCleanupItem protocolArray(CleanListImplementationArray, &availableEComProtocols);
	CleanupStack::PushL(protocolArray);
	REComSession::ListImplementationsL(KUidProtocolHandlerPluginInterface, availableEComProtocols);

	TInt error = KErrNone;
	for( TInt i=0; i<availableEComProtocols.Count(); ++i )
		{
		// Add the protocol as a heap based descriptor to the client descriptor array
		HBufC8* protocol = availableEComProtocols[i]->DataType().Alloc();
		if( protocol != NULL )
			{
			error = aProtocolArray.Append(protocol);
			if( error != KErrNone )
				{
				delete protocol;
				break;
				}
			}
		else
			{
			error = KErrNoMemory; // as protocol did not get allocated
			break;
			}
		}

	// Clean up ECom implementation array
	CleanupStack::PopAndDestroy(); // availableEComProtocols as TCleanUpItem
	if(error!=KErrNone)
		{
		// If an error occurs, cleanup passed in array and leave
		aProtocolArray.ResetAndDestroy();
		User::Leave(error);
		}
	}
コード例 #26
0
// ----------------------------------------------------------------------------
// 
// ----------------------------------------------------------------------------
//
void CWrtHarvester::RegisteredPublishersL( RPointerArray<HBufC>& publishers )
    {
    publishers.ResetAndDestroy();

    CLiwGenericParamList* publisherList( CLiwGenericParamList::NewLC() );
    CLiwGenericParamList* inParamList( CLiwGenericParamList::NewLC() );
    
    TLiwGenericParam type( KType, TLiwVariant( KPubData ));
    inParamList->AppendL( type );
    
    CLiwDefaultMap* filter = CLiwDefaultMap::NewLC();
    
    filter->InsertL( KPublisherId, TLiwVariant( KWRTPublisher ) );
    filter->InsertL( KContentType, TLiwVariant( KTemplatedWidget ) );
     
    //append filter to input param
    TLiwGenericParam item( KFilter, TLiwVariant( filter ));
    inParamList->AppendL( item );
       
    // Get all publishers from CPS
    iCPSInterface->ExecuteCmdL( KGetList, *inParamList, *publisherList ); 
    CleanupStack::PopAndDestroy( filter );
    CleanupStack::PopAndDestroy( inParamList );
    
    TInt pos = 0;
    publisherList->FindFirst( pos, KResults );
    if( pos != KErrNotFound )
        {
        //extract iterator on results list
        TLiwVariant variant = (*publisherList)[pos].Value();
        CLiwIterable* iterable = variant.AsIterable();
        iterable->Reset();
        
        //get all the templated widget publishers
        while( iterable->NextL( variant ) )
            {
            //extract content map
            CLiwDefaultMap* publisherMap = CLiwDefaultMap::NewLC();         
            variant.Get( *publisherMap );
            variant.Reset();
             
            if( publisherMap && publisherMap->FindL( KContentId , variant ))
                {
                 HBufC* bundleId = variant.AsDes().AllocLC();
                 publishers.AppendL( bundleId );
                 CleanupStack::Pop( bundleId );
                 }
             CleanupStack::PopAndDestroy( publisherMap );     
             }
            
        variant.Reset();
        }
    CleanupStack::PopAndDestroy( publisherList );
    }
コード例 #27
0
// ==========================================================================
// FUNCTION: SearchL
// ==========================================================================
EXPORT_C void CMsgStoreMailBox::SearchL( RMsgStoreSearchCriteria&  aSearchCriteria,
                                         MMsgStoreSearchClient&    aSearchClient )
    {
    if( aSearchCriteria.SearchStrings().Count() == 0  )
        {
        __LOG_STATIC_ENTER( "MsgClient", "SearchL" )
        __LOG_WRITE_ERROR( "no search string" )
        __LOG_STATIC_EXIT
        User::Leave( KErrArgument );
        } // end if
    
    TBool isEmptyFolderIdArray = EFalse;
    RArray<TMsgStoreId>& folderIds = aSearchCriteria.FolderIds();
    if( folderIds.Count() == 0 )
        {
        //a "global" search is requested, fill in with all the folders ids
        RPointerArray<CMsgStoreFolder> folders;
        FoldersL( folders );
        for ( TInt i = 0 ; i < folders.Count() ; i++ )
            {
            aSearchCriteria.AddFolderId( folders[i]->Id() );
            }
        folders.ResetAndDestroy();
        isEmptyFolderIdArray = ETrue;
        } // end if
    else
        {
        for ( TInt i = 0 ; i < folderIds.Count() ; i++ )
            {
            iContext.VerifyTypeL( folderIds[i], EMsgStoreFolderBits );
            }
        }
    
    if( iContext.iSearchHandler )
        {
        __LOG_STATIC_ENTER( "MsgClient", "SearchL" )
        __LOG_WRITE_ERROR( "search already in progress" )
        __LOG_STATIC_EXIT
        User::Leave( KErrInUse );
        } // end if   
    
    //cleanup search handlers from previous search sessions
    iOldSearchHandlers.ResetAndDestroy();
    
    iContext.iSearchHandler = CMsgStoreSearchHandler::NewL( iContext.iSession, aSearchCriteria, *this );
    iContext.iSearchClient  = &aSearchClient;
    
    if ( isEmptyFolderIdArray )
        {
        //retrore the folder id to empty array as it was received by this method
        folderIds.Reset();
        }
    }
コード例 #28
0
void CCalAlarmAttachTest::TestCopyEntryWithAlarmContentL()
    {
    test.Printf(_L("Test copying entry but delete the original one\n"));
    _LIT8(KUidEntryOriginal, "EntryOriginalUid");
    CCalAlarm* alarm = StoreEntryWithAlarmContentLC(KUidEntryOriginal());
    CleanupStack::PopAndDestroy(alarm);
    
    RPointerArray<CCalEntry> entries;
    CleanupResetAndDestroyPushL(entries);
    iTestLib->SynCGetEntryViewL().FetchL(KUidEntryOriginal(), entries);
    
    // Copy the entry from the original one
    _LIT8(KUidEntryCopy, "EntryCopyUid");
    HBufC8* guid1 = KUidEntryCopy().AllocLC();
    CCalEntry* copiedEntry = CCalEntry::NewL(CCalEntry::EEvent, guid1, CCalEntry::EMethodNone,0);
    CleanupStack::Pop(guid1);
    CleanupStack::PushL(copiedEntry);
    copiedEntry->CopyFromL(*entries[0],CCalEntry::EDontCopyId);//restore the alarmaction
    entries.ResetAndDestroy();
    entries.AppendL(copiedEntry);
    CleanupStack::Pop(copiedEntry);
     
 //delete the original entry that will delete the alarm and its content 
    CDesC8ArrayFlat* guidArray = new(ELeave)CDesC8ArrayFlat(1);
    CleanupStack::PushL(guidArray);
    guidArray->AppendL(KUidEntryOriginal());
    iTestLib->SynCGetEntryViewL().DeleteL(*guidArray);
    CleanupStack::PopAndDestroy(guidArray);
    
    //Store the copied entry and access its alarm content
    TestAlarmL(copiedEntry, KContent(), KMimeType());
    TInt entriesStored = 0;
    iTestLib->SynCGetEntryViewL().StoreL(entries, entriesStored);
    entries.ResetAndDestroy();
    iTestLib->SynCGetEntryViewL().FetchL(KUidEntryCopy(), entries);

    TestAlarmL(entries[0], KContent(), KMimeType());
    CleanupStack::PopAndDestroy(&entries);
    }
コード例 #29
0
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());
	}
コード例 #30
0
	void CBURTestStepBackup::BackupPublicDataL()
		/**
		@internalComponent
		@released
		*/
		{
		_LIT(KPublic, "Backup Public Data...");
		Log(LOG_LEVEL2, KPublic);
		RPointerArray<CSBGenericDataType> array;
		TRAP_IGNORE(GeneratePublicTransferTypesL(array));
		TRAP_IGNORE(DoPublicBackupL(array));
		array.ResetAndDestroy();
		array.Close();
		}