HBufC* CAgentAddressbook::ReadFieldAsTextL(const CContactItemField& itemField) { if (itemField.Storage() == NULL || !itemField.Storage()->IsFull()) return HBufC::NewL(0); switch (itemField.StorageType()) { case KStorageTypeText: { CContactTextField* txtField = itemField.TextStorage(); if (txtField == NULL) return HBufC::NewL(0); return txtField->Text().AllocL(); } case KStorageTypeDateTime: { CContactDateField* dateField = itemField.DateTimeStorage(); if (dateField == NULL) return HBufC::NewL(0); TTime time = dateField->Time(); _LIT(KFORMAT_DATE, "%D%M%Y%/0%1%/1%2%/2%3%/3"); TBuf<30> strTime; time.FormatL(strTime, KFORMAT_DATE); return strTime.AllocL(); } default: return HBufC::NewL(0); } }
// ----------------------------------------------------------------------------- // CLogPlayerManager::ReadSearchL // ----------------------------------------------------------------------------- // HBufC* CLogPlayerManager::ReadSearchL(RFileReadStream& aReadStream, TInt& aIndex) { aIndex = ReadNumberL(aReadStream); ReadTextL(aReadStream, iTextBuffer, KLogPlayerFieldSeparatorEndLine); TBuf<KLogPlayerMaxTextLength> searchQuery; searchQuery.Copy(iTextBuffer); return searchQuery.AllocL(); }
void CMemSpyEngineActiveObject::ConstructL( CMemSpyEngine& /*aEngine*/ ) { TBuf<256> item; _LIT(KBasicFormat, "\t0x%08x\t\t"); item.Format( KBasicFormat, VTable() ); // Add modifiers _LIT( KModifiers, "%d" ); _LIT( KBoxedCharFormat, " [%c]" ); item.AppendFormat( KModifiers, RequestStatusValue() ); if ( IsActive() ) { item.AppendFormat( KBoxedCharFormat, 'A' ); } if ( RequestIsPending() ) { item.AppendFormat( KBoxedCharFormat, 'P' ); } iCaption = item.AllocL(); // Listbox items TPtrC value; // Address _LIT(KCaption1, "\tAddress\t\t0x%08x"); item.Format( KCaption1, iAddress ); AppendL( item ); // vTable _LIT(KCaption2, "\tVTable\t\t0x%08x"); item.Format( KCaption2, iVTable ); AppendL( item ); // _LIT(KCaption3, "\tStatus Value\t\t%d"); item.Format( KCaption3, iRequestStatusValue ); AppendL( item ); // _LIT(KCaption5, "\tIs Active\t\t%S"); value.Set( YesNoValue( IsActive() ) ); item.Format( KCaption5, &value ); AppendL( item ); // _LIT(KCaption6, "\tRequest Pending\t\t%S"); value.Set( YesNoValue( RequestIsPending() ) ); item.Format( KCaption6, &value ); AppendL( item ); // _LIT(KCaption4, "\tPriority\t\t%d"); item.Format( KCaption4, iPriority ); AppendL( item ); }
HBufC* GetPlatformVersionL() { VersionInfo::TPlatformVersion platformVersion; User::LeaveIfError(VersionInfo::GetVersion(platformVersion)); TBuf<KBufferSize> version; version.AppendNum(platformVersion.iMajorVersion); version.Append('.'); version.AppendNum(platformVersion.iMinorVersion); return version.AllocL(); }
/* ------------------------------------------------------------------------------- tells Y-Browser the human readable name of the filetype shown in file type selection dialogs (like the include/exclude types in file search) ------------------------------------------------------------------------------- */ HBufC* CYBRecognizer1::FileTypeNameL(TInt aIndex) { TBuf<100> aName; switch(aIndex) { case 0: aName.Copy(KtxTypeName); break; } return aName.AllocL(); }
/** Function : doTestStepL Description : Verify if message part(s) of the message entries returned by sort mechanism are in the intended order. @return : TVerdict - Test step result */ TVerdict CT_MsgVerifySortResult::doTestStepL() { INFO_PRINTF1(_L("Test Step : VerifySortResult")); TPtrC fieldName; TBuf<1> buf; TBool sortedByTo = ETrue; TBool sortedByFrom = ETrue; TBool sortedByCc = ETrue; TBool sortedByBcc = ETrue; TBool sortedBySubject = ETrue; TBool sortedByUnRead = ETrue; TBool sortedByDetails = ETrue; TBool sortedByDescription = ETrue; TBool sortedByDate = ETrue; TBool sortedBySize = ETrue; TBool sortedByAttachment = ETrue; TBool sortedByPriority = ETrue; TBool sortedById = ETrue; TBool sortedByNewFlag = ETrue; TInt expectedSearchResultCount = 0; GetIntFromConfig(ConfigSection(), KExpectedResultCount, expectedSearchResultCount); // Read search result count TInt resultCount = 0; GetIntFromConfig(ConfigSection(), KCountOfResult, resultCount); // Read search result count if(expectedSearchResultCount > 0 && resultCount == 0) { ERR_PRINTF2(_L("Expected SORT Result Count > 0 and Actual SORT result count = %d"), resultCount); SetTestStepResult(EFail); } else if(expectedSearchResultCount == 0 && resultCount == 0) { SetTestStepResult(EPass); } else { RArray<TMsvEntry> messageEntries = iSharedDataCommon.iSearchSortResultArray; INFO_PRINTF2(_L("Number of entries to be verified = %d"), messageEntries.Count()); DisplayMsgEntryList(messageEntries); // Log the message entry details if ( !GetStringFromConfig( ConfigSection(), KSortMsgPart, fieldName)) { ERR_PRINTF1(_L("Message part to be verified for is not specified")); SetTestStepResult (EFail); } TMsvMessagePart msgPartValue = CT_MsgUtilsEnumConverter::ConvertDesToMessagePart(fieldName); TPtrC sortOrder; GetStringFromConfig(ConfigSection(), KSortOrder, sortOrder); TMsvSortOrder sortOption = CT_MsgUtilsEnumConverter::ConvertDesToSortOrder(sortOrder); CMsvEntry *entry = CMsvEntry::NewL(*iSharedDataCommon.iSession, KMsvRootIndexEntryId, TMsvSelectionOrdering()); CleanupStack::PushL(entry); switch(msgPartValue) { case EMsvTo: switch(sortOption) { case EMsvSortAscending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByTo; ++j) { entry->SetEntryL(messageEntries[j].Id()); CMsvStore* store1 = entry->ReadStoreL(); CleanupStack::PushL(store1); CImHeader* header1 = CImHeader::NewLC(); header1->RestoreL(*store1); // Retrieves the email message header HBufC* address1=HBufC::NewL(50); if(header1->ToRecipients().Count()) { address1 = (header1->ToRecipients()[0]).AllocL(); } CleanupStack::PopAndDestroy(2,store1); entry->SetEntryL(messageEntries[j+1].Id()); CMsvStore* store2 = entry->ReadStoreL(); CleanupStack::PushL(store2); CImHeader* header2 = CImHeader::NewLC(); header2->RestoreL(*store2); // Retrieves the email message header HBufC* address2=HBufC::NewL(50); // FIx when no fields are there if(header2->ToRecipients().Count()) { address2 = (header2->ToRecipients()[0]).AllocL(); } CleanupStack::PopAndDestroy(2,store2); if(address1->CompareF(*address2) > 0)// Checks if any messages is not in Ascending order w.r.t to TO field { ERR_PRINTF1(_L("Sorting by TO: Not in Ascending order")); sortedByTo = EFalse; SetTestStepResult(EFail); } delete address2; delete address1; } break; case EMsvSortDescending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByTo; ++j) { entry->SetEntryL(messageEntries[j].Id()); CMsvStore* store1 = entry->ReadStoreL(); CleanupStack::PushL(store1); CImHeader* header1 = CImHeader::NewLC(); header1->RestoreL(*store1); // Retrieves the email message header HBufC* address1=HBufC::NewL(50); if(header1->ToRecipients().Count()) { address1 = (header1->ToRecipients()[0]).AllocL(); } CleanupStack::PopAndDestroy(2,store1); entry->SetEntryL(messageEntries[j+1].Id()); CMsvStore* store2 = entry->ReadStoreL(); CleanupStack::PushL(store2); CImHeader* header2 = CImHeader::NewLC(); header2->RestoreL(*store2); // Retrieves the email message header HBufC* address2=HBufC::NewL(50); // FIx when no fields are there if(header2->ToRecipients().Count()) { address2 = (header2->ToRecipients()[0]).AllocL(); } CleanupStack::PopAndDestroy(2,store2); if(address1->CompareF(*address2) < 0)// Checks if any messages is not in Descending order w.r.t to TO field { ERR_PRINTF1(_L("Sorting by TO: Not in Descending order")); sortedByTo = EFalse; SetTestStepResult(EFail); } delete address2; delete address1; } break; } break; case EMsvFrom: switch(sortOption) { case EMsvSortAscending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByFrom; ++j) { entry->SetEntryL(messageEntries[j].Id()); CMsvStore* store1 = entry->ReadStoreL(); CleanupStack::PushL(store1); CImHeader* header1 = CImHeader::NewLC(); header1->RestoreL(*store1); // Retrieves the email message header HBufC* address1 = header1->From().AllocL(); CleanupStack::PopAndDestroy(2,store1); entry->SetEntryL(messageEntries[j+1].Id()); CMsvStore* store2 = entry->ReadStoreL(); CleanupStack::PushL(store2); CImHeader* header2 = CImHeader::NewLC(); header2->RestoreL(*store2); // Retrieves the email message header HBufC* address2 = header2->From().AllocL(); CleanupStack::PopAndDestroy(2,store2); if(address1->CompareF(*address2) > 0)// Checks if any messages is not in Ascending order w.r.t to FROM field { ERR_PRINTF1(_L("Sorting by From: Not in Ascending order")); sortedByFrom = EFalse; SetTestStepResult(EFail); } delete address2; delete address1; } break; case EMsvSortDescending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByFrom; ++j) { entry->SetEntryL(messageEntries[j].Id()); CMsvStore* store1 = entry->ReadStoreL(); CleanupStack::PushL(store1); CImHeader* header1 = CImHeader::NewLC(); header1->RestoreL(*store1); // Retrieves the email message header HBufC* address1 = header1->From().AllocL(); CleanupStack::PopAndDestroy(2,store1); entry->SetEntryL(messageEntries[j+1].Id()); CMsvStore* store2 = entry->ReadStoreL(); CleanupStack::PushL(store2); CImHeader* header2 = CImHeader::NewLC(); header2->RestoreL(*store2); // Retrieves the email message header HBufC* address2 = header2->From().AllocL(); CleanupStack::PopAndDestroy(2,store2); if(address1->CompareF(*address2) < 0)// Checks if any messages is not in Descending order w.r.t to FROM field { ERR_PRINTF1(_L("Sorting by From: Not in Descending order")); sortedByFrom = EFalse; SetTestStepResult(EFail); } delete address2; delete address1; } break; } break; case EMsvCc: switch(sortOption) { case EMsvSortAscending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByCc; ++j) { HBufC* address1 = HBufC::NewL(50); entry->SetEntryL(messageEntries[j].Id()); CMsvStore* store1 = entry->ReadStoreL(); CleanupStack::PushL(store1); CImHeader* header1 = CImHeader::NewLC(); header1->RestoreL(*store1); // Retrieves the email message header if(header1->CcRecipients().Count()) { address1 = (header1->CcRecipients()[0]).AllocL(); } CleanupStack::PopAndDestroy(2,store1); HBufC* address2 = HBufC::NewL(50); entry->SetEntryL(messageEntries[j+1].Id()); CMsvStore* store2 = entry->ReadStoreL(); CleanupStack::PushL(store2); CImHeader* header2 = CImHeader::NewLC(); header2->RestoreL(*store2); // Retrieves the email message header if(header2->CcRecipients().Count()) { address2 = (header2->CcRecipients()[0]).AllocL(); } CleanupStack::PopAndDestroy(2,store2); if(address1->CompareF(*address2) > 0)// Checks if any messages is not in Ascending order w.r.t to CC field { ERR_PRINTF1(_L("Sorting by CC: Not in Ascending order")); sortedByCc = EFalse; SetTestStepResult(EFail); } delete address2; delete address1; } break; case EMsvSortDescending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByCc; ++j) { HBufC* address1 = HBufC::NewL(50); entry->SetEntryL(messageEntries[j].Id()); CMsvStore* store1 = entry->ReadStoreL(); CleanupStack::PushL(store1); CImHeader* header1 = CImHeader::NewLC(); header1->RestoreL(*store1); // Retrieves the email message header if(header1->CcRecipients().Count()) { address1 = (header1->CcRecipients()[0]).AllocL(); } CleanupStack::PopAndDestroy(2,store1); HBufC* address2 = HBufC::NewL(50); entry->SetEntryL(messageEntries[j+1].Id()); CMsvStore* store2 = entry->ReadStoreL(); CleanupStack::PushL(store2); CImHeader* header2 = CImHeader::NewLC(); header2->RestoreL(*store2); // Retrieves the email message header if(header2->CcRecipients().Count()) { address2 = (header2->CcRecipients()[0]).AllocL(); } CleanupStack::PopAndDestroy(2,store2); if(address1->CompareF(*address2) < 0)// Checks if any messages is not in Descending order w.r.t to CC field { ERR_PRINTF1(_L("Sorting by CC: Not in Descending order")); sortedByCc = EFalse; SetTestStepResult(EFail); } delete address2; delete address1; } break; } break; case EMsvBcc: switch(sortOption) { case EMsvSortAscending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByBcc; ++j) { HBufC* address1 = HBufC::NewL(50); if(messageEntries[j].iMtm != KUidMsgTypeSMS) { entry->SetEntryL(messageEntries[j].Id()); CMsvStore* store1 = entry->ReadStoreL(); CleanupStack::PushL(store1); CImHeader* header1 = CImHeader::NewLC(); header1->RestoreL(*store1); // Retrieves the email message header if(header1->BccRecipients().Count()) { address1 = (header1->BccRecipients()[0]).AllocL(); } CleanupStack::PopAndDestroy(2,store1); } else { buf.Copy(_L("")); address1 = buf.AllocL(); } HBufC* address2 = HBufC::NewL(50); if(messageEntries[j+1].iMtm != KUidMsgTypeSMS) { entry->SetEntryL(messageEntries[j+1].Id()); CMsvStore* store2 = entry->ReadStoreL(); CleanupStack::PushL(store2); CImHeader* header2 = CImHeader::NewLC(); header2->RestoreL(*store2); // Retrieves the email message header if(header2->BccRecipients().Count()) { address2 = (header2->BccRecipients()[0]).AllocL(); } CleanupStack::PopAndDestroy(2,store2); } else { buf.Copy(_L("")); address2 = buf.AllocL(); } if(address1->CompareF(*address2) > 0)// Checks if any messages is not in Ascending order w.r.t to BCC field { ERR_PRINTF1(_L("Sorting by BCC: Not in Ascending order")); sortedByBcc = EFalse; SetTestStepResult(EFail); } delete address2; delete address1; } break; case EMsvSortDescending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByBcc; ++j) { HBufC* address1 = HBufC::NewL(50); if(messageEntries[j].iMtm != KUidMsgTypeSMS) { entry->SetEntryL(messageEntries[j].Id()); CMsvStore* store1 = entry->ReadStoreL(); CleanupStack::PushL(store1); CImHeader* header1 = CImHeader::NewLC(); header1->RestoreL(*store1); // Retrieves the email message header if(header1->BccRecipients().Count()) { address1 = (header1->BccRecipients()[0]).AllocL(); } CleanupStack::PopAndDestroy(2,store1); } else { buf.Copy(_L("")); address1 = buf.AllocL(); } HBufC* address2 = HBufC::NewL(50); if(messageEntries[j].iMtm != KUidMsgTypeSMS) { entry->SetEntryL(messageEntries[j+1].Id()); CMsvStore* store2 = entry->ReadStoreL(); CleanupStack::PushL(store2); CImHeader* header2 = CImHeader::NewLC(); header2->RestoreL(*store2); // Retrieves the email message header if(header2->BccRecipients().Count()) { address2 = (header2->BccRecipients()[0]).AllocL(); } CleanupStack::PopAndDestroy(2,store2); } else { buf.Copy(_L("")); address2 = buf.AllocL(); } if(address1->CompareF(*address2) < 0)// Checks if any messages is not in Descending order w.r.t to BCC field { ERR_PRINTF1(_L("Sorting by BCC: Not in Descending order")); sortedByBcc = EFalse; SetTestStepResult(EFail); } delete address2; delete address1; } break; } break; case EMsvSubject: switch(sortOption) { case EMsvSortAscending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedBySubject; ++j) { entry->SetEntryL(messageEntries[j].Id()); CMsvStore* store1 = entry->ReadStoreL(); CleanupStack::PushL(store1); CImHeader* header1 = CImHeader::NewLC(); header1->RestoreL(*store1); // Retrieves the email message header HBufC* subject1 = header1->Subject().AllocL(); CleanupStack::PopAndDestroy(2,store1); entry->SetEntryL(messageEntries[j+1].Id()); CMsvStore* store2 = entry->ReadStoreL(); CleanupStack::PushL(store2); CImHeader* header2 = CImHeader::NewLC(); header2->RestoreL(*store2); // Retrieves the email message header HBufC* subject2 = header2->Subject().AllocL(); CleanupStack::PopAndDestroy(2,store2); if(subject1->CompareF(*subject2) > 0)// Checks if any messages is not in Ascending order w.r.t to SUBJECT field { ERR_PRINTF1(_L("Sorting by Subject: Not in Ascending order")); sortedBySubject = EFalse; SetTestStepResult(EFail); } delete subject2; delete subject1; } break; case EMsvSortDescending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedBySubject; ++j) { entry->SetEntryL(messageEntries[j].Id()); CMsvStore* store1 = entry->ReadStoreL(); CleanupStack::PushL(store1); CImHeader* header1 = CImHeader::NewLC(); header1->RestoreL(*store1); // Retrieves the email message header entry->SetEntryL(messageEntries[j+1].Id()); CMsvStore* store2 = entry->ReadStoreL(); CleanupStack::PushL(store2); CImHeader* header2 = CImHeader::NewLC(); header2->RestoreL(*store2); // Retrieves the email message header if(header1->Subject().CompareF(header2->Subject()) < 0)// Checks if any messages is not in Descending order w.r.t to SUBJECT field { ERR_PRINTF1(_L("Sorting by Subject: Not in Descending order")); sortedBySubject = EFalse; SetTestStepResult(EFail); } CleanupStack::PopAndDestroy(4, store1); } break; } break; case EMsvUnreadMessages: switch(sortOption) { case EMsvSortAscending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByUnRead; ++j) { if(messageEntries[j].Unread() > messageEntries[j+1].Unread()) // Checks if any messages is not in Ascending order { ERR_PRINTF1(_L("Sorting by UnReadFlag: Not in Ascending order")); sortedByUnRead = EFalse; SetTestStepResult(EFail); } } break; case EMsvSortDescending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByUnRead; ++j) { if(messageEntries[j].Unread() < messageEntries[j+1].Unread()) // Checks if any messages is not in Descending order { ERR_PRINTF1(_L("Sorting by UnReadFlag: Not in Descending order")); sortedByUnRead = EFalse; SetTestStepResult(EFail); } } } break; case EMsvDetails: switch(sortOption) { case EMsvSortAscending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByDetails; ++j) { if(messageEntries[j].iDetails.CompareF(messageEntries[j+1].iDetails) > 0)// Checks if any messages is not in Ascending order { ERR_PRINTF1(_L("Sorting by Details: Not in Ascending order")); sortedByDetails = EFalse; SetTestStepResult(EFail); } } break; case EMsvSortDescending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByDetails; ++j) { if(messageEntries[j].iDetails.CompareF(messageEntries[j+1].iDetails) < 0) // Checks if any messages is not in Descending order { ERR_PRINTF1(_L("Sorting by Details: Not in Descending order")); sortedByDetails = EFalse; SetTestStepResult(EFail); } } } break; case EMsvDescription: switch(sortOption) { case EMsvSortAscending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByDescription; ++j) { if(messageEntries[j].iDescription.CompareF(messageEntries[j+1].iDescription) > 0)// Checks if any messages is not in Ascending order { ERR_PRINTF1(_L("Sorting by Description: Not in Ascending order")); sortedByDescription = EFalse; SetTestStepResult(EFail); } } break; case EMsvSortDescending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByDescription; ++j) { if(messageEntries[j].iDescription.CompareF(messageEntries[j+1].iDescription) < 0) // Checks if any messages is not in Descending order { ERR_PRINTF1(_L("Sorting by Description: Not in Descending order")); sortedByDescription = EFalse; SetTestStepResult(EFail); } } } break; case EMsvDate: switch(sortOption) { case EMsvSortAscending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByDate; ++j) { if(messageEntries[j].iDate > messageEntries[j+1].iDate) // Checks if any messages is not in Ascending order { ERR_PRINTF1(_L("Sorting by Date: Not in Ascending order")); sortedByDate = EFalse; SetTestStepResult(EFail); } } break; case EMsvSortDescending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByDate; ++j) { if(messageEntries[j].iDate < messageEntries[j+1].iDate) // Checks if any messages is not in Descending order { ERR_PRINTF1(_L("Sorting by Date: Not in Descending order")); sortedByDate = EFalse; SetTestStepResult(EFail); } } } break; case EMsvSize: switch(sortOption) { case EMsvSortAscending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedBySize; ++j) { if(messageEntries[j].iSize > messageEntries[j+1].iSize) // Checks if any messages is not in Ascending order { ERR_PRINTF1(_L("Sorting by Size: Not in Ascending order")); sortedBySize = EFalse; SetTestStepResult(EFail); } } break; case EMsvSortDescending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedBySize; ++j) { if(messageEntries[j].iSize < messageEntries[j+1].iSize) // Checks if any messages is not in Descending order { ERR_PRINTF1(_L("Sorting by Size: Not in Descending order")); sortedBySize = EFalse; SetTestStepResult(EFail); } } } break; case EMsvAttachment: switch(sortOption) { case EMsvSortAscending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByAttachment; ++j) { if(messageEntries[j].Attachment() > messageEntries[j+1].Attachment()) // Checks if any messages is not in Ascending order { ERR_PRINTF1(_L("Sorting by AttachmentFlag: Not in Ascending order")); sortedByAttachment = EFalse; SetTestStepResult(EFail); } } break; case EMsvSortDescending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByAttachment; ++j) { if(messageEntries[j].Attachment() < messageEntries[j+1].Attachment()) // Checks if any messages is not in Descending order { ERR_PRINTF1(_L("Sorting by AttachmentFlag: Not in Descending order")); sortedByAttachment = EFalse; SetTestStepResult(EFail); } } } break; case EMsvNew: switch(sortOption) { case EMsvSortAscending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByNewFlag; ++j) { if(messageEntries[j].New() < messageEntries[j+1].New()) // Checks if any messages is not in Ascending order { ERR_PRINTF1(_L("Sorting by NewFlag: Not in Ascending order")); sortedByNewFlag = EFalse; SetTestStepResult(EFail); } } break; case EMsvSortDescending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByNewFlag; ++j) { if(messageEntries[j].New() > messageEntries[j+1].New()) // Checks if any messages is not in Descending order { ERR_PRINTF1(_L("Sorting by NewFlag: Not in Descending order")); sortedByNewFlag = EFalse; SetTestStepResult(EFail); } } } break; case EMsvBody: SetTestStepError(KErrNotSupported); break; case EMsvPriority: switch(sortOption) { case EMsvSortAscending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByPriority; ++j) { if(messageEntries[j].Priority() < messageEntries[j+1].Priority()) // Checks if any messages is not in Ascending order { ERR_PRINTF1(_L("Sorting by AttachmentFlag: Not in Ascending order")); sortedByPriority = EFalse; SetTestStepResult(EFail); } } break; case EMsvSortDescending: for(TInt j = 0; j < messageEntries.Count() - 1 && sortedByPriority; ++j) { if(messageEntries[j].Priority() > messageEntries[j+1].Priority()) // Checks if any messages is not in Descending order { ERR_PRINTF1(_L("Sorting by AttachmentFlag: Not in Descending order")); sortedByPriority = EFalse; SetTestStepResult(EFail); } } } break; case EMsvMtmTypeUID: break; } CleanupStack::PopAndDestroy(1, entry); } return TestStepResult(); }
void CMemSpyEngineCodeSegEntry::ConstructL() { iFileName = HBufC::NewL( iCreateInfo.iFileName.Length() ); iFileName->Des().Copy( iCreateInfo.iFileName ); // Make caption TParsePtrC parser( *iFileName ); const TPtrC pFileNameWithoutPath( parser.NameAndExt() ); TBuf<KMaxFullName + 128> item; // _LIT(KCodeSegFormat, "\t%S\t\t%S code"); const TMemSpySizeText codeSize( MemSpyEngineUtils::FormatSizeText( iCreateInfo.iCodeSize ) ); item.Format( KCodeSegFormat, &pFileNameWithoutPath, &codeSize ); if ( iCreateInfo.iDataSize > 0 ) { _LIT(KCodeSegFormatAdditionalData, ", %S data"); const TMemSpySizeText dataSize( MemSpyEngineUtils::FormatSizeText( iCreateInfo.iTotalDataSize ) ); item.AppendFormat( KCodeSegFormatAdditionalData, &dataSize ); } iCaption = item.AllocL(); // _LIT(KItem0, "\tName\t\t%S"); item.Format( KItem0, &pFileNameWithoutPath ); AppendL( item ); // Uids const TUidType uids( iCreateInfo.iUids ); for( TInt i=0; i<KMaxCheckedUid; i++ ) { _LIT(KItem1, "\tUid #%d\t\t0x%08x"); const TUid uidValue( uids[ i ] ); // item.Format( KItem1, i+1, uidValue.iUid ); AppendL( item ); } // if ( iCreateInfo.iModuleVersion == KModuleVersionWild ) { _LIT(KItem12, "\tModule Version\t\t[Wild]"); AppendL( KItem12 ); } else if ( iCreateInfo.iModuleVersion == KModuleVersionNull ) { _LIT(KItem12, "\tModule Version\t\t[Null]"); AppendL( KItem12 ); } else { _LIT(KItem12, "\tModule Version\t\t0x%08x"); item.Format( KItem12, iCreateInfo.iModuleVersion ); AppendL( item ); } // _LIT(KItem13, "\tSID\t\t0x%08x"); item.Format( KItem13, iCreateInfo.iS.iSecureId ); AppendL( item ); // _LIT(KItem14, "\tVID\t\t0x%08x"); item.Format( KItem14, iCreateInfo.iS.iVendorId ); AppendL( item ); // if ( iCreateInfo.iCodeSize > 0 ) { _LIT(KItem2, "\tCode Size\t\t%d"); item.Format( KItem2, iCreateInfo.iCodeSize ); AppendL( item ); } // if ( iCreateInfo.iTotalDataSize > 0 ) { _LIT(KItem6, "\tTotal Data Size\t\t%d"); item.Format( KItem6, iCreateInfo.iTotalDataSize ); AppendL( item ); } // if ( iCreateInfo.iTextSize > 0 ) { _LIT(KItem3, "\tText Size\t\t%d"); item.Format( KItem3, iCreateInfo.iTextSize ); AppendL( item ); } // if ( iCreateInfo.iDataSize > 0 ) { _LIT(KItem4, "\tData Size\t\t%d"); item.Format( KItem4, iCreateInfo.iDataSize ); AppendL( item ); } // if ( iCreateInfo.iBssSize > 0 ) { _LIT(KItem5, "\tBSS Size\t\t%d"); item.Format( KItem5, iCreateInfo.iBssSize ); AppendL( item ); } // _LIT(KItem7, "\tEntrypoint Veneer\t\t0x%08x"); item.Format( KItem7, iCreateInfo.iEntryPtVeneer ); AppendL( item ); // _LIT(KItem8, "\tFile Entrypoint\t\t0x%08x"); item.Format( KItem8, iCreateInfo.iFileEntryPoint ); AppendL( item ); // _LIT(KItem9, "\tDependency Count\t\t%d"); item.Format( KItem9, iCreateInfo.iDepCount ); AppendL( item ); // if ( iCreateInfo.iCodeLoadAddress != 0 ) { _LIT(KItem10, "\tROM Code Load Addr.\t\t0x%08x"); item.Format( KItem10, iCreateInfo.iCodeLoadAddress ); AppendL( item ); } else { _LIT(KItem10, "\tROM Code Load Addr.\t\t[RAM Loaded]"); AppendL( KItem10 ); } // if ( iCreateInfo.iDataLoadAddress != 0 ) { _LIT(KItem11, "\tData Load Addr.\t\t0x%08x"); item.Format( KItem11, iCreateInfo.iDataLoadAddress ); AppendL( item ); } // AddCapabilityItemsL(); }
bool base_tests(MApp_context& ctx, MOutput& aOutput, int retest) { int retest_count=1; #define RECREATE { CleanupStack::PopAndDestroy(); CCurrentLoc* loc=CCurrentLoc::NewL(ctx, cellid_names); CleanupStack::PushL(loc); loc->add_sinkL(l); } #define RETEST(interval) { now+=TTimeIntervalMinutes(interval); test_time=now; if(retest==0 || retest_count==retest) { RECREATE l->Expect(prev_e); test_time-=TTimeIntervalMinutes(interval); } ++retest_count; } CGenericIntMap* cellid_names=CGenericIntMap::NewL(); CleanupStack::PushL(cellid_names); cellid_names->SetDeletor(delete_bufc); TTime test_time; int i; for (i=1; i<100; i++) { TBuf<10> ib; ib.AppendNum(i); cellid_names->AddDataL(i, (void*)ib.AllocL()); } CTestLog *l=CTestLog::NewL(aOutput); CleanupStack::PushL(l); CCurrentLoc* loc=CCurrentLoc::NewL(ctx, cellid_names); CleanupStack::PushL(loc); loc->add_sinkL(l); now=TTime(1); loc->EmptyLog(); _LIT(cell, "1, 1, T"); CTestLog::TExpectItem prev_e; aOutput.Print(_L("start at a base\n")); prev_e=l->Expect(Mlogger::VALUE, _L("base"), _L("last: "), TTime(0)); l->Expect(Mlogger::VALUE, _L("base"), _L("1"), now); loc->now_at_location(cell, 1, true, true, now); l->GotP(); aOutput.Print(_L("move out\n")); now+=TTimeIntervalMinutes(15); prev_e=l->Expect(Mlogger::VALUE, _L("base"), _L("last: 1"), now); loc->now_at_location(cell, 2, false, true, now); l->GotP(); RETEST(0) loc->now_at_location(cell, 2, false, true, now); l->GotP(); aOutput.Print(_L("come to another non-base cell\n")); RETEST(1) loc->now_at_location(cell, 3, false, true, now); aOutput.Print(_L("come to a new base\n")); RETEST(10) l->Expect(Mlogger::VALUE, _L("base"), _L("4"), now); loc->now_at_location(cell, 4, true, true, now); l->GotP(); aOutput.Print(_L("stay in base, different cell\n")); RETEST(1) loc->now_at_location(cell, 5, true, false, now); aOutput.Print(_L("move out\n")); RETEST(15) TTime ppprev=now; prev_e=l->Expect(Mlogger::VALUE, _L("base"), _L("last: 4"), test_time); loc->now_at_location(cell, 6, false, true, now); l->GotP(); aOutput.Print(_L("move out 2\n")); RETEST(5) loc->now_at_location(cell, 7, false, true, now); aOutput.Print(_L("notice this cell is a base\n")); TTime pprev=now; RETEST(0) l->Expect(Mlogger::VALUE, _L("base"), _L("7"), now); loc->now_at_location(cell, 7, true, false, now); l->GotP(); aOutput.Print(_L("move out\n")); RETEST(15) TTime prev=test_time; prev_e=l->Expect(Mlogger::VALUE, _L("base"), _L("last: 7"), test_time); loc->now_at_location(cell, 8, false, true, now); RETEST(5) loc->now_at_location(cell, 9, false, true, now); l->GotP(); aOutput.Print(_L("come to a base\n")); RETEST(10) l->Expect(Mlogger::VALUE, _L("base"), _L("10"), now); loc->now_at_location(cell, 10, true, true, now); l->GotP(); aOutput.Print(_L("leave quickly\n")); RETEST(1) prev_e=l->Expect(Mlogger::VALUE, _L("base"), _L("last: 7"), prev); loc->now_at_location(cell, 11, false, true, now); l->GotP(); aOutput.Print(_L("come back to previous after long time\n")); RETEST(1) l->Expect(Mlogger::VALUE, _L("base"), _L("7"), now); loc->now_at_location(cell, 7, true, true, now); l->GotP(); now+=TTimeIntervalMinutes(20); loc->now_at_location(cell, 7, true, false, now); aOutput.Print(_L("leave\n")); RETEST(30) pprev=test_time; prev_e=l->Expect(Mlogger::VALUE, _L("base"), _L("last: 7"), test_time); loc->now_at_location(cell, 12, false, true, now); l->GotP(); aOutput.Print(_L("enter new base\n")); RETEST(30) prev=now; l->Expect(Mlogger::VALUE, _L("base"), _L("13"), now); loc->now_at_location(cell, 13, true, true, now); l->GotP(); now+=TTimeIntervalMinutes(20); loc->now_at_location(cell, 13, true, false, now); aOutput.Print(_L("leave\n")); RETEST(10) prev_e=l->Expect(Mlogger::VALUE, _L("base"), _L("last: 13"), now); loc->now_at_location(cell, 14, false, true, now); l->GotP(); aOutput.Print(_L("come back quickly\n")); RETEST(8) prev_e=l->Expect(Mlogger::VALUE, _L("base"), _L("last: 7"), pprev); l->Expect(Mlogger::VALUE, _L("base"), _L("13"), prev); loc->now_at_location(cell, 13, true, true, now); l->GotP(); now+=TTimeIntervalMinutes(20); loc->now_at_location(cell, 13, true, false, now); aOutput.Print(_L("move out, to another base\n")); RETEST(10) prev_e=l->Expect(Mlogger::VALUE, _L("base"), _L("last: 13"), now); l->Expect(Mlogger::VALUE, _L("base"), _L("15"), now); loc->now_at_location(cell, 15, true, true, now); l->GotP(); aOutput.Print(_L("come back quickly\n")); RETEST(8) prev_e=l->Expect(Mlogger::VALUE, _L("base"), _L("last: 7"), pprev); l->Expect(Mlogger::VALUE, _L("base"), _L("13"), prev); loc->now_at_location(cell, 13, true, true, now); l->GotP(); RECREATE prev=now; now+=TTimeIntervalMinutes(30); l->Expect(prev_e); l->Expect(Mlogger::VALUE, _L("base"), _L("last: 13"), prev); loc->now_at_location(cell, 16, false, true, now); l->GotP(); CleanupStack::PopAndDestroy(3); if (retest>0 && retest_count <= retest) return false; return true; }
void CMemSpyEngineChunkEntry::ConstructL( const TMemSpyDriverChunkInfo& aInfo ) { // Copy info iInfo = new(ELeave) TMemSpyDriverChunkInfo(); *iInfo = aInfo; // Make caption TBuf<KMaxFullName+128> item; _LIT(KCaptionFormat, "\t%S\t\t%d"); item.Format( KCaptionFormat, &Name(), Size() ); iCaption = item.AllocL(); // Make other items iList = CMemSpyEngineOutputList::NewL(); _LIT( KEntry0, "Name"); iList->AddItemL( KEntry0, Name() ); _LIT( KEntryType, "Type" ); switch( aInfo.iType ) { default: case EMemSpyDriverChunkTypeUnknown: iList->AddItemL( KEntryType, _L("Unknown") ); break; case EMemSpyDriverChunkTypeHeap: iList->AddItemL( KEntryType, _L("Heap") ); break; case EMemSpyDriverChunkTypeHeapKernel: iList->AddItemL( KEntryType, _L("Kernel Heap") ); break; case EMemSpyDriverChunkTypeStackAndProcessGlobalData: iList->AddItemL( KEntryType, _L("Stack and Process Global Data") ); break; case EMemSpyDriverChunkTypeStackKernel: iList->AddItemL( KEntryType, _L("Kernel Stack") ); break; case EMemSpyDriverChunkTypeGlobalData: iList->AddItemL( KEntryType, _L("Global Data") ); break; case EMemSpyDriverChunkTypeCode: iList->AddItemL( KEntryType, _L("Code") ); break; case EMemSpyDriverChunkTypeCodeGlobal: iList->AddItemL( KEntryType, _L("Global Code") ); break; case EMemSpyDriverChunkTypeCodeSelfModifiable: iList->AddItemL( KEntryType, _L("Self Modifiable Code") ); break; case EMemSpyDriverChunkTypeLocal: iList->AddItemL( KEntryType, _L("Local") ); break; case EMemSpyDriverChunkTypeGlobal: iList->AddItemL( KEntryType, _L("Global") ); break; case EMemSpyDriverChunkTypeRamDrive: iList->AddItemL( KEntryType, _L("RAM Drive") ); break; } _LIT( KEntry1, "Owning Process"); OwnerName( item ); iList->AddItemL( KEntry1, item ); _LIT( KEntry2, "Address" ); _LIT( KEntry2Format, "0x%08x - 0x%08x" ); item.Format( KEntry2Format, BaseAddress(), UpperAddress() ); iList->AddItemL( KEntry2, item ); _LIT( KEntry3, "Size"); iList->AddItemL( KEntry3, Size() ); _LIT( KEntry4, "Max. Size"); iList->AddItemL( KEntry4, MaxSize() ); _LIT( KEntryAttributeFormat, "Attribute %d"); TInt attribNum = 0; // if ( aInfo.iAttributes & ENormal ) { item.Format( KEntryAttributeFormat, ++attribNum ); iList->AddItemL( item, _L("Normal") ); } if ( aInfo.iAttributes & EDoubleEnded ) { item.Format( KEntryAttributeFormat, ++attribNum ); iList->AddItemL( item, _L("Double Ended") ); } if ( aInfo.iAttributes & EDisconnected ) { item.Format( KEntryAttributeFormat, ++attribNum ); iList->AddItemL( item, _L("Disconnected") ); } if ( aInfo.iAttributes & EConstructed ) { item.Format( KEntryAttributeFormat, ++attribNum ); iList->AddItemL( item, _L("Constructed") ); } if ( aInfo.iAttributes & EMemoryNotOwned ) { item.Format( KEntryAttributeFormat, ++attribNum ); iList->AddItemL( item, _L("Memory Not Owned") ); } }
// // Parse/Set data members // void CTelVoiceMailboxParser::ParseL(CParsedFieldCollection& aIacpFields) { TBuf<64> aFieldValueBuf; if ((aFieldValueBuf= aIacpFields.GetFieldValue(SMS_TEL_VOICE_MAILBOX_NUM)) != TPtrC()) iTel= aFieldValueBuf.AllocL(); }
// ----------------------------------------------------------------------------- // CSconVersionInfo::FetchInfoL() // fetch device info // ----------------------------------------------------------------------------- // void CSconVersionInfo::FetchInfoL( RFs& aFs ) { TRACE_FUNC_ENTRY; iSymbianVersionError = SysVersionInfo::GetVersionInfo( iSymbianVersion, aFs ); iS60VersionError = VersionInfo::GetVersion( iS60Version, aFs ); TBuf<KSysVersionInfoTextLength> info; TBuf<KSysVersionInfoTextLength> productBuf; TInt err(KErrNone); delete iSWVersion; iSWVersion = NULL; delete iProduct; iProduct = NULL; // get SW version, SW version date and model TRAP( err, CapUtil::GetSWVersionL( info, iDate, productBuf ) ); iSWVersion = info.AllocL(); iProduct = productBuf.AllocL(); LOGGER_WRITE_1("CapUtil::GetSWVersionL err: %d", err); SysVersionInfo::TProductVersion productVersion; TInt sysVersionError = SysVersionInfo::GetVersionInfo( productVersion, aFs ); LOGGER_WRITE_1( "SysVersionInfo::GetVersionInfo returned : %d", sysVersionError ); // Use TelServer to get IMEI and also other info if SysVersionInfo is not supported RTelServer telServer; User::LeaveIfError( telServer.Connect() ); CleanupClosePushL( telServer ); RTelServer::TPhoneInfo teleinfo; User::LeaveIfError( telServer.GetPhoneInfo( 0, teleinfo ) ); RMobilePhone phone; User::LeaveIfError( phone.Open( telServer, teleinfo.iName ) ); CleanupClosePushL( phone ); User::LeaveIfError(phone.Initialise()); TUint32 teleidentityCaps; phone.GetIdentityCaps( teleidentityCaps ); RMobilePhone::TMobilePhoneIdentityV1 telid; TRequestStatus status; phone.GetPhoneId( status, telid ); User::WaitForRequest( status ); if ( status == KErrNone ) { if ( sysVersionError ) { LOGGER_WRITE("Use info from TMobilePhoneIdentityV1"); delete iModel; iModel = NULL; delete iRevision; iRevision = NULL; // phone model sales name. For example "N01". iModel = telid.iModel.AllocL(); // product revision. For example "01" iRevision = telid.iRevision.AllocL(); } delete iSerialNumber; iSerialNumber = NULL; // Phone serial number (IMEI or ESN), in character string format. iSerialNumber = telid.iSerialNumber.AllocL(); } CleanupStack::PopAndDestroy( &phone ); CleanupStack::PopAndDestroy( &telServer ); if ( sysVersionError == KErrNone ) { // use information from SysVersionInfo instead of previous APIs. LOGGER_WRITE("Using SysVersionInfo"); // phone model sales name. For example "N01". delete iModel; iModel = NULL; iModel = productVersion.iModel.AllocL(); // product revision. For example "01" delete iRevision; iRevision = NULL; iRevision = productVersion.iRevision.AllocL(); // manufacturer name. For example "Nokia" delete iManufacturer; iManufacturer = NULL; iManufacturer = productVersion.iManufacturer.AllocL(); // product code name. For example "RM-1" delete iProduct; iProduct = NULL; iProduct = productVersion.iProduct.AllocL(); } else { CapUtil::GetManufacturer( info ); delete iManufacturer; iManufacturer = NULL; iManufacturer = info.AllocL(); } CapUtil::GetLanguage( iLanguage ); err = SysVersionInfo::GetVersionInfo( SysVersionInfo::EFWVersion, info, aFs ); delete iSysVersionInfo; iSysVersionInfo = NULL; if ( !err ) { iSysVersionInfo = info.AllocL(); } err = SysUtil::GetLangVersion( info ); delete iLangVersion; iLangVersion = NULL; if ( !err ) { iLangVersion = info.AllocL(); } sysVersionError = SysUtil::GetLangSWVersion( info ); delete iLangSWVersion; iLangSWVersion = NULL; if ( !sysVersionError ) { iLangSWVersion = info.AllocL(); } sysVersionError = SysVersionInfo::GetVersionInfo( SysVersionInfo::EOPVersion, info, aFs ); delete iOPVersion; iOPVersion = NULL; if ( !sysVersionError ) { iOPVersion = info.AllocL(); } sysVersionError = SysVersionInfo::GetVersionInfo( SysVersionInfo::EProductCode, info, aFs ); delete iProductCode; iProductCode = NULL; if ( !sysVersionError ) { iProductCode = info.AllocL(); } // read DesktopSync key value CRepository* repository(NULL); TRAP( iDesktopSyncError, repository = CRepository::NewL( KCRUidDSDCMOConfig )); if ( !iDesktopSyncError ) { iDesktopSyncError = repository->Get( KNsmlDesktopSync, iDesktopSync ); LOGGER_WRITE_1("iDesktopSyncError: %d", iDesktopSyncError ); LOGGER_WRITE_1("iDesktopSync: %d", iDesktopSync ); delete repository; } else { LOGGER_WRITE_1("Could not create CRepository, err: %d", iDesktopSyncError ); } // screen size HAL::Get(HAL::EDisplayXPixels, iScreenSize.iWidth); HAL::Get(HAL::EDisplayYPixels, iScreenSize.iHeight); iInfoFetched = ETrue; TRACE_FUNC_EXIT; }