void CLpdGlobalPluginDialog::AddRequestorsParamL() { LOCVERIFIERDLGDEBUG( "+CLpdGlobalPluginDialog::AddRequestorsParamL" ); CDesC16ArrayFlat* array = new CDesC16ArrayFlat(8); TInt reqCount = iRequestInfo->iRequestors.Count(); if (!reqCount) { HBufC* requestor = HbTextResolverSymbian::LoadL(KUnknownRequestor); CleanupStack::PushL(requestor); array->AppendL(requestor->Des()); CleanupStack::PopAndDestroy(requestor); } else { for (TInt i = 0; i < reqCount; ++i) { array->AppendL(iRequestInfo->iRequestors[i]->RequestorIdString()); } } TInt count = array->MdcaCount(); MDesCArray* marray = static_cast<MDesCArray*> (array); CHbSymbianVariant* requestors = CHbSymbianVariant::NewL(marray, CHbSymbianVariant::EDesArray); mSymbianVariantMap->Add(KRequestorKey, requestors); LOCVERIFIERDLGDEBUG( "-CLpdGlobalPluginDialog::AddRequestorsParamL" ); }
LOCAL_C void DoStartL() { // Create active scheduler (to run active objects) CActiveScheduler* scheduler = new (ELeave) CActiveScheduler(); CleanupStack::PushL(scheduler); CActiveScheduler::Install(scheduler); RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); CFed* fed = CFed::NewL(*console, fs); CleanupStack::PushL(fed); CDesC16ArrayFlat* argsBuf = new(ELeave) CDesC16ArrayFlat(4); CleanupStack::PushL(argsBuf); CCommandLineArguments* args = CCommandLineArguments::NewLC(); for (TInt i = 1; i < args->Count(); i++) // Start from 1 as arg zero is the exe name { // No attempt to be clever with arguments - this code is only used when building a raw non-fshell version - mainfshell has the nicer equivalent TPtrC arg = args->Arg(i); argsBuf->AppendL(arg); } CleanupStack::PopAndDestroy(args); CleanupStack::Pop(argsBuf); gFed = fed; fed->StartL(argsBuf); CActiveScheduler::Start(); // Delete active scheduler CleanupStack::PopAndDestroy(3, scheduler); // fed, fs, scheduler }
// --------------------------------------------------------------------------- // // --------------------------------------------------------------------------- // void CCaUsifScanner::GetCaPackageEntriesL( RPointerArray<CCaInnerEntry>& aArray ) { CCaInnerQuery* allAppQuery = CCaInnerQuery::NewLC(); CDesC16ArrayFlat* appType = new ( ELeave ) CDesC16ArrayFlat( KGranularityOne ); CleanupStack::PushL( appType ); appType->AppendL( KCaTypePackage ); allAppQuery->SetEntryTypeNames( appType ); CleanupStack::Pop( appType ); iStorageProxy.GetEntriesL( allAppQuery, aArray ); CleanupStack::PopAndDestroy( allAppQuery ); }
// ----------------------------------------------------------------------------- // CPsetCallDiverting::GetDefaultNumbersL // ----------------------------------------------------------------------------- // TInt CPsetCallDiverting::GetDefaultNumbersL( CDesC16ArrayFlat & aDefNumbers ) { _LIT( KNumber1,"111111" ); _LIT( KNumber2,"222222" ); aDefNumbers.AppendL(KNumber1()); aDefNumbers.AppendL(KNumber2()); SMC_MOCK_METHOD1( TInt, CDesC16ArrayFlat &, aDefNumbers ) }
const TDesC& CTTGPSLoggerPositioningMethod::SettingTextL() // show text { CDesC16ArrayFlat *itemArray = new (ELeave) CDesC16ArrayFlat(5); CleanupStack::PushL(itemArray); // in case the appends leave RPositionServer iPositionServer; RPositioner iPositioner; User::LeaveIfError(iPositionServer.Connect()); User::LeaveIfError(iPositioner.Open(iPositionServer)); TUint aModules = 0; // Get the available numbers of modules User::LeaveIfError(iPositionServer.GetNumModules(aModules)); TPositionModuleInfo info; // Prepare itemArray and itemArrayDetails itemArray->AppendL(_L("(Default)")); for(TUint i = 0; i < aModules; i++) { if ((iPositionServer.GetModuleInfoByIndex(i,info) == KErrNone) && (info.IsAvailable())) { TBuf<200> smallBuffer; smallBuffer.Zero(); info.GetModuleName(smallBuffer); itemArray->AppendL(smallBuffer); } } iPositioner.Close(); iPositionServer.Close(); iDispl.Zero(); if ((iPosMethod>aModules)||(iPosMethod<0)) iPosMethod=0; // Default iDispl.Copy((*itemArray)[iPosMethod]); CleanupStack::PopAndDestroy(); // itemArray return(iDispl); }
// ------------------------------------------------ // PostProcessL // ------------------------------------------------ // void CMdSFindSequence::PostProcessL( CMdCSerializationBuffer& aSerializedResultBuffer ) { #ifdef _DEBUG _LIT( KFindFunctionName, "CMdSFindSequence::PostProcessL" ); #endif // process only on items result if (!iLastResultModeItems) { return; } if(iFindOperation && iFindOperation->FindCriteria().IncludesFreetexts() == EFalse ) { return; } if (!iFindOperation) { return; } RPointerArray<HBufC>& searchFreeText = iFindOperation->QueryFreeText(); // to through every object and check freetext aSerializedResultBuffer.PositionL( KNoOffset ); const TMdCItems& items = TMdCItems::GetFromBufferL( aSerializedResultBuffer ); const TBool needToSort = searchFreeText.Count() != 0 && items.iObjects.iPtr.iCount > 1; RArray<TObjectHitCount> hitCountArray; CleanupClosePushL( hitCountArray ); TObjectHitCount hitCount; for( TUint32 i = 0; i < items.iObjects.iPtr.iCount; ++i ) { aSerializedResultBuffer.PositionL( items.iObjects.iPtr.iOffset + i * sizeof(TMdCObject) ); const TMdCObject& object = TMdCObject::GetFromBufferL( aSerializedResultBuffer ); // check all objects // jump to freetext if ( object.iFreeTexts.iPtr.iCount == 0 ) { continue; } CDesC16ArrayFlat* resultWordBuffer = new(ELeave) CDesC16ArrayFlat( object.iFreeTexts.iPtr.iCount ); CleanupStack::PushL( resultWordBuffer ); // get freetext for object GetFreeTextForObjectL( *resultWordBuffer, items.iNamespaceDefId, object.iId ); __ASSERT_DEBUG( object.iFreeTexts.iPtr.iCount == resultWordBuffer->Count(), User::Panic( KFindFunctionName, KErrCorrupt) ); if (needToSort) { hitCount.iObjectOffset = items.iObjects.iPtr.iOffset + i * sizeof(TMdCObject); hitCount.iCount = GetFreeTextHitCountL( *resultWordBuffer, searchFreeText ); hitCountArray.AppendL( hitCount ); } aSerializedResultBuffer.PositionL( object.iFreeTexts.iPtr.iOffset ); for ( TUint32 f = 0; f < object.iFreeTexts.iPtr.iCount; ++f ) { // insert freeText here TPtrC16 word = (*resultWordBuffer)[f]; aSerializedResultBuffer.InsertL( word ); } CleanupStack::PopAndDestroy( resultWordBuffer ); } if ( needToSort && hitCountArray.Count() > 1 ) { hitCountArray.Sort( TLinearOrder<TObjectHitCount>( SortValues ) ); RArray<TMdCObject> objectArray; CleanupClosePushL( objectArray ); objectArray.ReserveL( items.iObjects.iPtr.iCount ); // store objects in array in correct order for( TInt i = 0; i < items.iObjects.iPtr.iCount; ++i ) { aSerializedResultBuffer.PositionL( hitCountArray[i].iObjectOffset ); const TMdCObject& object = TMdCObject::GetFromBufferL( aSerializedResultBuffer ); objectArray.AppendL( object ); } // set them back in serialized buffer aSerializedResultBuffer.PositionL( items.iObjects.iPtr.iOffset ); for (TInt i = 0; i < items.iObjects.iPtr.iCount; ++i) { objectArray[i].SerializeL( aSerializedResultBuffer ); } CleanupStack::PopAndDestroy( &objectArray ); } CleanupStack::PopAndDestroy( &hitCountArray ); }
void CTTGPSLoggerPositioningMethod::EditItemL(TBool aCalledFromMenu) // edit text { CDesC16ArrayFlat *itemArray = new (ELeave) CDesC16ArrayFlat(20); CDesC16ArrayFlat *itemArrayDetails = new (ELeave) CDesC16ArrayFlat(20); CleanupStack::PushL(itemArray); // in case the appends leave CleanupStack::PushL(itemArrayDetails); // in case the appends leave RPositionServer iPositionServer; RPositioner iPositioner; User::LeaveIfError(iPositionServer.Connect()); User::LeaveIfError(iPositioner.Open(iPositionServer)); itemArray->AppendL(_L("(Info on all modules)")); itemArray->AppendL(_L("(Default)")); TUint aModules = 0; TInt defaultModule=-1; // Get the available numbers of modules User::LeaveIfError(iPositionServer.GetNumModules(aModules)); TPositionModuleInfo info; TPositionModuleId aModuleId; iPositionServer.GetDefaultModuleId(aModuleId); // Prepare itemArray and itemArrayDetails for(TUint i = 0; i < aModules; i++) { if ((iPositionServer.GetModuleInfoByIndex(i,info) == KErrNone) && (info.IsAvailable())) { TBuf<200> smallBuffer; smallBuffer.Zero(); info.GetModuleName(smallBuffer); itemArray->AppendL(smallBuffer); TBuf<200> buffer; buffer.Zero(); info.GetModuleName(buffer); buffer.Append(_L(" (")); if (info.DeviceLocation() & TPositionModuleInfo::EDeviceExternal) buffer.Append(_L("External ")); if (info.DeviceLocation() & TPositionModuleInfo::EDeviceInternal) buffer.Append(_L("Internal ")); if (info.DeviceLocation() & TPositionModuleInfo::EDeviceUnknown) buffer.Append(_L("Unknown ")); if (info.TechnologyType()& TPositionModuleInfo::ETechnologyAssisted) buffer.Append(_L("Assisted ")); if (info.TechnologyType()& TPositionModuleInfo::ETechnologyTerminal) buffer.Append(_L("GPS, ")); if (info.TechnologyType()& TPositionModuleInfo::ETechnologyNetwork) buffer.Append(_L("Network, ")); if (info.TechnologyType()& TPositionModuleInfo::ETechnologyUnknown) buffer.Append(_L("Unknown tech, ")); if (buffer.Mid(buffer.Length()-2, 2).Compare( _L(", ")) == KErrNone) buffer.Replace(buffer.Length()-2, 2, _L(")")); if (buffer.Mid(buffer.Length()-1, 1).Compare( _L(" ")) == KErrNone) buffer.Replace(buffer.Length()-1, 1, _L(")")); if ( info.ModuleId() == aModuleId) { buffer.Append(_L(" [Default]")); defaultModule=i; } itemArrayDetails->AppendL(buffer); } } iPositioner.Close(); iPositionServer.Close(); // Present list of positioning methods TInt selectIndex; selectIndex=iPosMethod+1; HBufC* title = NULL; title = CEikonEnv::Static()->AllocReadResourceLC(R_TTGP_TBUF32_DIALOG_POSITIONING_TITLE); // Select positioning method: CAknListQueryDialog* dialog = new (ELeave) CAknListQueryDialog(&selectIndex); dialog->PrepareLC(R_TTGP_DIALOG_LISTQUERY); dialog->QueryHeading()->SetTextL(*title); dialog->SetItemTextArray(itemArray); dialog->SetOwnershipType(ELbmDoesNotOwnItemArray); TInt answer = dialog->RunLD(); CleanupStack::PopAndDestroy(); // title // Check answer if (answer) { if (selectIndex==0) // (Info on all modules) { TBuf<1000> aText; aText.Zero(); for (TInt i=0;i<itemArrayDetails->Count();i++) { aText.AppendFormat(_L("%d. "), i+1); aText.Append(itemArrayDetails->MdcaPoint(i)); if (i<itemArrayDetails->Count()-1) aText.Append(_L("\n")); } HBufC* title = CEikonEnv::Static()->AllocReadResourceLC(R_TTGP_TBUF32_AVAILABLEPOSITIONING_TITLE); // Available modules: CAknMessageQueryDialog* dialog = new (ELeave) CAknMessageQueryDialog(); CleanupStack::PushL(dialog); dialog->PrepareLC(R_TTGP_DIALOG_MESSAGEQUERY_OK); dialog->QueryHeading()->SetTextL(*title); dialog->SetMessageTextL(aText); CleanupStack::Pop(); // dialog dialog->RunLD(); CleanupStack::PopAndDestroy(); // title } else if (selectIndex==1) // Default module { if (defaultModule>-1) { // Present default module name HBufC* title = CEikonEnv::Static()->AllocReadResourceLC(R_TTGP_TBUF32_SELECTEDPOSITIONING_TITLE); // Selected module: CAknMessageQueryDialog* dialog = new (ELeave) CAknMessageQueryDialog(); CleanupStack::PushL(dialog); dialog->PrepareLC(R_TTGP_DIALOG_MESSAGEQUERY_OK); dialog->QueryHeading()->SetTextL(*title); dialog->SetMessageTextL(itemArrayDetails->MdcaPoint(defaultModule)); CleanupStack::Pop(); // dialog dialog->RunLD(); CleanupStack::PopAndDestroy(); // title } iPosMethod=0; // default module selected C_APPUI->Engine()->Requester()->SetPositioningMethod(iPosMethod); C_APPUI->Engine()->Requester()->StartL(); } else if (selectIndex>1) // Custom selection of the module { HBufC* title = CEikonEnv::Static()->AllocReadResourceLC(R_TTGP_TBUF32_SELECTEDPOSITIONING_TITLE); // Selected module: CAknMessageQueryDialog* dialog = new (ELeave) CAknMessageQueryDialog(); CleanupStack::PushL(dialog); dialog->PrepareLC(R_TTGP_DIALOG_MESSAGEQUERY_OK); dialog->QueryHeading()->SetTextL(*title); dialog->SetMessageTextL(itemArrayDetails->MdcaPoint(selectIndex-2)); CleanupStack::Pop(); // dialog dialog->RunLD(); CleanupStack::PopAndDestroy(); // title iPosMethod=selectIndex-1; C_APPUI->Engine()->Requester()->SetPositioningMethod(iPosMethod); C_APPUI->Engine()->Requester()->StartL(); } UpdateListBoxTextL(); } CleanupStack::PopAndDestroy(); // itemArrayDetails CleanupStack::PopAndDestroy(); // itemArray }