// ----------------------------------------------------------------------------- // CTestSDKLists::TestSTXLBGetColorUseListL // ----------------------------------------------------------------------------- // TInt CTestSDKLists::TestSTXLBGetColorUseListL( CStifItemParser& /*aItem*/ ) { // Print to UI _LIT( KTestModule, "EIKTXLBXTestModule" ); _LIT( KTestEIKTXLBX, "In TestSTXLBGetColorUseListL" ); TestModuleIf().Printf( 0, KTestModule, KTestEIKTXLBX ); // Print to log file iLog->Log( KTestEIKTXLBX ); TInt flags = CEikListBox::EIncrementalMatching | EAknListBoxSelectionList | EAknListBoxViewerFlags | CEikListBox::ELeftDownInViewRect; CDesCArray* textArray = iEikonEnvPointer->ReadDesCArrayResourceL( R_TESTLIST_ITEM_SETTING ); CleanupStack::PushL( textArray ); CEikSnakingTextListBox* list = new( ELeave ) CEikSnakingTextListBox(); CleanupStack::PushL( list ); list->ConstructL( iContainer, flags ); list->Model()->SetItemTextArray( textArray ); list->Model()->SetOwnershipType( ELbmOwnsItemArray ); iContainer->SetControlL( list ); CArrayFixFlat<TCoeColorUse>* colorUseList = new( ELeave ) CArrayFixFlat<TCoeColorUse>( KFour ); CleanupStack::PushL( colorUseList ); list->GetColorUseListL( *colorUseList ); colorUseList->Reset(); CleanupStack::PopAndDestroy( colorUseList ); iContainer->ResetControl(); CleanupStack::Pop( 2 ); return KErrNone; }
void CContextMediaArrayImpl::ReadFromStorage() { CALLSTACKITEM_N(_CL("CContextMediaArrayImpl"), _CL("ReadFromStorage")); iPostIdArray->Reset(); ReleasePosts(); iPostArray->Reset(); TBool ok = iStorage.FirstL(iNode, iSort, CPostStorage::EAscending, EFalse); while (ok) { TInt64 id = iStorage.GetCurrentIdL(); iPostIdArray->AppendL(id); iPostArray->AppendL(0); ok = iStorage.NextL(); } if (iStandAlone && iNode==iStorage.RootId()) { iPostIdArray->AppendL(iStorage.RootId()); iPostArray->AppendL(0); } }
// --------------------------------------------------------------------------- // Get an array of image quality levels that are in use with the current // product with given Camera/Display ID. If the ID is zero, then all levels // dispite of the ID value are returned. // --------------------------------------------------------------------------- // TInt CImagingConfigManager::GetImageQualityLevelsL( CArrayFixFlat<TUint>& aLevels, TUint /*aCameraDisplayID*/ ) { aLevels.Reset(); for( TInt i = 0 ; i < NumberOfImageQualityLevels() ; i++ ) { aLevels.AppendL( iImageQualitySets->At( i ).iImageQualitySetLevel ); } return KErrNone; }
/** Searches the scheduler for an existing schedule item with a schedule time that matches with time supplied. @see RScheduler::GetScheduleL() @param aScheduler Handle to the scheduler. @param aStartTime Schedule start time. @param aRef On return, the schedule item. @leave KErrNotFound No schedule found matching the schedule time. */ EXPORT_C void CMsvScheduleSend::FindScheduleL(RScheduler& aScheduler, const TTime& aStartTime, TSchedulerItemRef& aRef) { CArrayFixFlat<TScheduleEntryInfo2>* entryInfos = new (ELeave) CArrayFixFlat<TScheduleEntryInfo2>(1); CleanupStack::PushL(entryInfos); CArrayFixFlat<TTaskInfo>* taskInfos = new (ELeave) CArrayFixFlat<TTaskInfo>(1); CleanupStack::PushL(taskInfos); aRef.iHandle = KErrNotFound; CArrayFixFlat<TSchedulerItemRef>* refs = new (ELeave) CArrayFixFlat<TSchedulerItemRef>(KMsvSchsendArrayGrowth); CleanupStack::PushL(refs); User::LeaveIfError(aScheduler.GetTaskRefsL(*refs, EAllSchedules, EMyTasks)); TInt count = refs->Count(); TScheduleState2 state; TTsTime nextDue; while (count-- && aRef.iHandle == KErrNotFound) { const TSchedulerItemRef& tempRef = (*refs)[count]; TScheduleType type; User::LeaveIfError(aScheduler.GetScheduleTypeL(tempRef.iHandle, type)); if( type == ETimeSchedule ) { entryInfos->Reset(); taskInfos->Reset(); const TInt err = aScheduler.GetScheduleL(tempRef.iHandle, state, *entryInfos, *taskInfos, nextDue); if( err == KErrNone && nextDue.GetUtcTime() == aStartTime ) aRef = tempRef; } } CleanupStack::PopAndDestroy(3, entryInfos); if (aRef.iHandle == KErrNotFound) User::Leave(KErrNotFound); }
/** Searches the scheduler for an existing conditions schedule item with a set of pending conditions and timeout value that matches with those supplied. @see RScheduler::GetScheduleL @param aScheduler Handle to the scheduler. @param aConditions The set of System Agent conditions that are required to be met to trigger the schedule. @param aTimeout The timeout value for the schedule. @param aRef On return, the schedule item. @leave KErrNotFound No schedule found matching the schedule conditions and timeout. */ EXPORT_C void CMsvScheduleSend::FindScheduleL( RScheduler& aScheduler, const CArrayFixFlat<TTaskSchedulerCondition>& aConditions, const TTime& aTimeout, TSchedulerItemRef& aRef) { CArrayFixFlat<TTaskSchedulerCondition>* schConditions = new (ELeave) CArrayFixFlat<TTaskSchedulerCondition>(KMsvSchsendArrayGrowth); CleanupStack::PushL(schConditions); CArrayFixFlat<TTaskInfo>* taskInfos = new (ELeave) CArrayFixFlat<TTaskInfo>(1); CleanupStack::PushL(taskInfos); aRef.iHandle = KErrNotFound; CArrayFixFlat<TSchedulerItemRef>* refs = new (ELeave) CArrayFixFlat<TSchedulerItemRef>(KMsvSchsendArrayGrowth); CleanupStack::PushL(refs); User::LeaveIfError(aScheduler.GetTaskRefsL(*refs, EAllSchedules, EMyTasks)); TInt count = refs->Count(); TScheduleState2 state; TTsTime nextTimeout; while( count-- && aRef.iHandle == KErrNotFound ) { const TSchedulerItemRef& tempRef = (*refs)[count]; TScheduleType type; User::LeaveIfError(aScheduler.GetScheduleTypeL(tempRef.iHandle, type)); if( type == EConditionSchedule ) { taskInfos->Reset(); const TInt err = aScheduler.GetScheduleL(tempRef.iHandle, state, *schConditions, nextTimeout, *taskInfos); if( err == KErrNone && nextTimeout.GetUtcTime() == aTimeout && *schConditions == aConditions ) aRef = tempRef; } } CleanupStack::PopAndDestroy(3, schConditions); if (aRef.iHandle == KErrNotFound) User::Leave(KErrNotFound); }
// ----------------------------------------------------------------------------- // CTestSDKMiscControls::TestCGGetColorUseListL // ----------------------------------------------------------------------------- // TInt CTestSDKMiscControls::TestCGGetColorUseListL( CStifItemParser& /*aItem*/ ) { // Print to UI _LIT( Ktestsdkmisccontrols, "testsdkmisccontrols" ); _LIT( KTestCGGetColorUseListL, "In TestCGGetColorUseListL" ); TestModuleIf().Printf( 0, Ktestsdkmisccontrols, KTestCGGetColorUseListL ); // Print to log file iLog->Log( KTestCGGetColorUseListL ); CArrayFixFlat<TCoeColorUse>* colorUseList = new( ELeave ) CArrayFixFlat<TCoeColorUse>( 4 ); CleanupStack::PushL( colorUseList ); TBool err = KErrNone; TRAP( err, iControlGroup->GetColorUseListL( *colorUseList ) ); colorUseList->Reset(); CleanupStack::PopAndDestroy( colorUseList ); return err; }
void CMsvScheduleSend::PopulateScheduleConditionsL(CArrayFixFlat<TTaskSchedulerCondition>& aSchConditions) { aSchConditions.Reset(); TInt count = iAgentActions->Count(); TTaskSchedulerCondition condition; // All system agent condition have a UID of KUidSystemCategory. condition.iCategory = KUidSystemCategory; for( TInt i = 0; i < count; ++i ) { TMsvCondition agentCondition = iAgentActions->At(i).iCondition; condition.iKey = agentCondition.iVariable.iUid; condition.iState = agentCondition.iState; switch( agentCondition.iType ) { case TMsvCondition::EMsvSchSendEquals: condition.iType = TTaskSchedulerCondition::EEquals; break; case TMsvCondition::EMsvSchSendNotEquals: condition.iType = TTaskSchedulerCondition::ENotEquals; break; case TMsvCondition::EMsvSchSendGreaterThan: condition.iType = TTaskSchedulerCondition::EGreaterThan; break; case TMsvCondition::EMsvSchSendLessThan: condition.iType = TTaskSchedulerCondition::ELessThan; break; default: User::Invariant(); break; } aSchConditions.AppendL(condition); } }
void CHuiRasterizedTextMesh::DoBuildL(TInt aRasterizeFlags) { if(iUsingPreRasterizedMesh) { return; } TSize extents(0, 0); HUI_DEBUG(_L("CHuiRasterizedTextMesh::BuildL() - Updating rasterized text.")); // This is never NULL during BuildL(). const TDesC& text = *Text(); // Retrieve the text style used when rasterizing this text mesh. THuiTextStyle* textStyle = CHuiStatic::Env().TextStyleManager().TextStyle(iTextStyleId); // Retrieve the CFont object used when rasterizing this text mesh. CFont* font = textStyle->Font().NearestFontL(iTextMeshScale); // Maximum width of a text line in pixels. TInt maxWidth = MaxLineWidth(); TInt startIndex = 0; TInt index = 0; TInt lineCount = 0; CArrayFixFlat<TPtrC>* linePtrs = new (ELeave) CArrayFixFlat<TPtrC>(KLineArrayGranularity); CleanupStack::PushL(linePtrs); while(startIndex < text.Length()) { /// @todo What is the Symbian way to determine line break chars? #define HUI_IS_LINE_BREAK(aChar) (aChar == '\n') // Find the next logical line. while(index < text.Length() && !HUI_IS_LINE_BREAK(text[index])) { index++; } TPtrC logicalLine = text.Mid(startIndex, index - startIndex); ++index; // Skip the line break. startIndex = index; switch(LineMode()) { case ELineModeTruncate: { ++lineCount; // there's always one line created per logical line HBufC* buf = logicalLine.AllocLC(); TPtr ptr = buf->Des(); // truncate line CHuiStatic::ConvertToVisualAndClipL(ptr, *font, maxWidth, maxWidth); // create the line entry if not already existing if (aRasterizeFlags != ERasterizeNone) { if (iLines.Count() < lineCount) { SRasterizedLine line; line.iTexture = NULL; line.iGap = 0; iLines.AppendL(line); if (iPictographInterface) { SRasterizedLine pictographline; pictographline.iTexture = NULL; pictographline.iGap = 0; iPictographLines.AppendL(pictographline); } } TInt currentLine = lineCount-1; if (aRasterizeFlags & ERasterizeText) { // rasterize a single line (updates texture in iLines[0].iTexture) RasterizeLineL(ptr, iLines[currentLine]); } if (aRasterizeFlags & ERasterizePictographs && iPictographInterface) { // Rasterize pictographs if needed RasterizePictographLineL(ptr, font, iPictographLines[currentLine]); } // Get extents from the texture we just created CHuiTexture* tex = iLines[currentLine].iTexture; extents.iHeight += iLines[currentLine].iGap; if(tex) { extents.iWidth = Max(extents.iWidth, tex->Size().iWidth); extents.iHeight += tex->Size().iHeight; } } else { // Don't rasterise or create textures, just get the extents of this text. TSize lineExtents = textStyle->LineExtentsL(ptr); extents.iWidth = Max(extents.iWidth, lineExtents.iWidth); extents.iHeight += lineExtents.iHeight; } CleanupStack::PopAndDestroy(buf); break; } case ELineModeWrap: { // wrap lines to array HBufC* buf = CHuiStatic::ConvertToVisualAndWrapToArrayL( logicalLine, maxWidth, *font, *linePtrs); CleanupStack::PushL(buf); // one line may create several wrapped lines lineCount += linePtrs->Count(); if (aRasterizeFlags != ERasterizeNone) { // create new entries.. while (iLines.Count() < lineCount) { SRasterizedLine line; line.iTexture = NULL; line.iGap = 0; iLines.AppendL(line); if (iPictographInterface) { SRasterizedLine pictographline; pictographline.iTexture = NULL; pictographline.iGap = 0; iPictographLines.AppendL(pictographline); } } // Do rasterisation if we want to render to texture. for(TInt i = 0; i < linePtrs->Count(); ++i) { TInt currentLine = (lineCount - linePtrs->Count()) + i; if (aRasterizeFlags & ERasterizeText) { // rasterize a single line (updates texture in iLines[i].iTexture) RasterizeLineL(linePtrs->At(i), iLines[currentLine]); } if (aRasterizeFlags & ERasterizePictographs && iPictographInterface) { // Rasterize pictographs if needed RasterizePictographLineL(linePtrs->At(i), font, iPictographLines[currentLine]); } // Get extents from the texture we just created CHuiTexture* tex = iLines[i].iTexture; extents.iHeight += iLines[i].iGap; if(tex) { extents.iWidth = Max(extents.iWidth, tex->Size().iWidth); extents.iHeight += tex->Size().iHeight; } TBool moreAvailable = (currentLine + 1 < MaxLineCount()); if (!moreAvailable) { // Maximum number of lines reached. break; } } } else { // Don't rasterise or create textures, just get the extents of this text. for(TInt i = 0; i < linePtrs->Count(); ++i) { TSize lineExtents = textStyle->LineExtentsL(linePtrs->At(i)); extents.iWidth = Max(extents.iWidth, lineExtents.iWidth); extents.iHeight += lineExtents.iHeight; } } linePtrs->Reset(); CleanupStack::PopAndDestroy(buf); break; } default: break; } // If we have reached the maximum number of lines, stop building. if(IsMaxLineCountReached()) { break; } } HUI_DEBUG(_L("CHuiRasterizedTextMesh::BuildL() - Finished rasterizing text.")); CleanupStack::PopAndDestroy(linePtrs); linePtrs = 0; if (iPictographBitmap) { iPictographBitmap->Resize(TSize(0, 0)); } HUI_DEBUG(_L("CHuiRasterizedTextMesh::BuildL() - Updating text extents..")); // The extents of the mesh depend on how many lines there are. SetExtents(extents); HUI_DEBUG(_L("CHuiRasterizedTextMesh::BuildL() - Done!")); }
/** @SYMTestCaseID APPFWK-APPARC-0070 @SYMPREQ @SYMTestCaseDesc Test whether the default app icons change with respect to the locale/language. This testcase checks whether BaflUtils::NearestLanguageFile is called when the locale has been changed. @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions Call User::Language() to check that the default locale is English; Call CT_LocaleStep::CheckIcons to check the size of the current default icons; Call UserSvr::ChangeLocale to change the Locale to French; Call CT_LocaleStep::CheckIcons to check the size of the new icons; Restore the file system and the locale and check if the icons are restored. API Calls:\n @SYMTestExpectedResults Returns KErrNone */ void CT_LocaleStep::TestLocaleDefaultIconL() { INFO_PRINTF1(_L("APPFWK-APPARC-0070: TestLocaleDefaultIconL started...")); TInt ret = 0; //first checks that language is not currently set to French (any other language except English since English is the default language TEST(User::Language()!=ELangFrench); // getappiconsizes must be called to check if the icons are the default ones // KUidCustomiseDefaultIconApp - uid of CustomiseDefaultIconApp_reg.RSS; this app has a localisable resource file, CustomiseDefaultIconApp_loc.RSS, that does not define any icon // Hence, the default icons must be picked up when the language changes to French. The default icons for French are defined in default_app_icon.m02 CArrayFixFlat<TSize>* newIconSizes = new(ELeave) CArrayFixFlat<TSize>(3); CleanupStack::PushL(newIconSizes); TRAP(ret,iLs.GetAppIconSizes(KUidCustomiseDefaultIconApp, *newIconSizes)); TEST(ret==KErrNone); TEST(newIconSizes->Count()!=0); // these are the sizes of the default icons TSize small(24,24); TSize medium(32,32); TSize large(48,48); TSize fstIcon; TSize secIcon; TSize trdIcon; CheckIcons(newIconSizes, small, medium,large, fstIcon, secIcon, trdIcon); // Change the locale to French TRAP(ret,ChangeLocaleL(ELangFrench)); TEST(ret==KErrNone); TEST(User::Language()==ELangFrench);//checks that the language has been set to French //Wait for a small period to let apparc receive language change notification User::After(KDelayForOnDemand); //call getappiconsizes to see if the new icons have been changed as as expected // The size of the icons indicates whether the icon corresponding to French Locale has been picked up newIconSizes->Reset(); TRAP(ret,iLs.GetAppIconSizes(KUidCustomiseDefaultIconApp, *newIconSizes)); TEST(ret==KErrNone); TEST(newIconSizes->Count()!=0); small.SetSize(25,25); medium.SetSize(35,35); large.SetSize(50,50); CheckIcons(newIconSizes, small, medium,large, fstIcon, secIcon, trdIcon); //have to restore the locale before exiting the testcase TRAP(ret,ChangeLocaleL(ELangEnglish)); TEST(ret==KErrNone); TEST(User::Language()==ELangEnglish); //Again wait for a small period to let apparc receive language change notification User::After(KDelayForOnDemand); //call getappiconsizes to see if the new icons have been changed as as expected // The size of the icons indicates whether the icon corresponding to English Locale has been picked up newIconSizes->Reset(); TRAP(ret,iLs.GetAppIconSizes(KUidCustomiseDefaultIconApp, *newIconSizes)); TEST(ret==KErrNone); TEST(newIconSizes->Count()!=0); small.SetSize(24,24); medium.SetSize(32,32); large.SetSize(48,48); CheckIcons(newIconSizes, small, medium,large, fstIcon, secIcon, trdIcon); // Icon cleanup CleanupStack::PopAndDestroy(newIconSizes); newIconSizes=NULL; INFO_PRINTF1(_L("APPFWK-APPARC-0070: TestLocaleDefaultIconL finished...")); }