HBufC* CPolicyStore::MakeNewPolicyNameL(const TDes& aOriginalPolicyName, TInt aSequenceNumber) { LOG_("-> CPolicyStore::MakeNewPolicyName"); const TInt KMaxSequenceNumberStringLength = 32; _LIT(KSequenceNumberFormat, "(%d)"); HBufC* sequenceNumberString = HBufC::NewLC(KMaxSequenceNumberStringLength); sequenceNumberString->Des().Format(KSequenceNumberFormat, aSequenceNumber); // New name string to be returned HBufC* retBuf(NULL); // Usage of Trim method in PinParser decreases the length by 2 items TInt spaceLeft = aOriginalPolicyName.MaxLength() - 2 - aOriginalPolicyName.Length(); TInt sequenceNumberStringLength = sequenceNumberString->Length(); if (sequenceNumberStringLength <= spaceLeft) { // There's enough free space for the sequence // number, so we can just add append it LOG_1(" Sequence number string: '%S'", &(*sequenceNumberString)); // Determine final string length for dynamic allocation TInt len = aOriginalPolicyName.Length() + sequenceNumberString->Length(); retBuf = HBufC::NewLC(len); // Construct the final name string TPtr16 ptr = retBuf->Des(); ptr.Append(aOriginalPolicyName.Left(aOriginalPolicyName.Length())); ptr.Append(sequenceNumberString->Left(sequenceNumberString->Length())); } else { // There's not enough space for the sequence // number so we override the end of the policy // name with the sequence number TInt lengap = sequenceNumberStringLength - spaceLeft; // Determine final string length for dynamic allocation TInt len = aOriginalPolicyName.MaxLength(); retBuf = HBufC::NewLC(len); // Construct the final name string TPtr16 ptr = retBuf->Des(); ptr.Append(aOriginalPolicyName.Left(aOriginalPolicyName.Length() - lengap)); ptr.Append(sequenceNumberString->Left(sequenceNumberString->Length())); } // Just pop, and delete the non-returned value explicitly CleanupStack::Pop(2); // retBuf, sequenceNumberString delete sequenceNumberString; LOG_("<- CPolicyStore::MakeNewPolicyName"); return retBuf; }
TBool CPolicyStore::DoEnsureUniquePolicyNameL(TVpnPolicyDetails& aPolicyDetails) { LOG(Log::Printf(_L("-> CPolicyStore::DoEnsureUniquePolicyNameL"))); TBool nameChanged = EFalse; TBool isUnique = EFalse; HBufC* newName = aPolicyDetails.iName.AllocLC(); TInt sequenceNumber = 2; while (!isUnique && sequenceNumber < KMaxTInt) { if (PolicyNameExists(*newName)) { if (newName != NULL) { CleanupStack::PopAndDestroy(newName); LOG_(" Pop (newName)"); newName = NULL; } newName = MakeNewPolicyNameL(aPolicyDetails.iName, sequenceNumber); CleanupStack::PushL(newName); sequenceNumber++; nameChanged = ETrue; } else { isUnique = ETrue; } } if (nameChanged) { // We now have a new unique policy name so we can save it // Make sure there's no risk of overflow aPolicyDetails.iName.Copy(newName->Left(aPolicyDetails.iName.MaxLength())); } if (newName != NULL) { CleanupStack::PopAndDestroy(); // newName } LOG(Log::Printf(_L("<- CPolicyStore::DoEnsureUniquePolicyName"))); return nameChanged; }
TBool WidgetUnzipUtilityS60::RunUnzipL() { CZipFileMember* member = iMembers->NextL(); if (member) { CleanupStack::PushL(member); RZipFileMemberReaderStream* stream; User::LeaveIfError(iZipFile->GetInputStreamL(member, stream)); CleanupStack::PushL(stream); HBufC8* buffer = HBufC8::NewLC(member->UncompressedSize()); TPtr8 bufferPtr(buffer->Des()); User::LeaveIfError(stream->Read(bufferPtr, member->UncompressedSize())); TFileName text; text.Copy(*iTempZipPath); text.Append(_L('\\')); text.Append(*member->Name()); HBufC* zipedFileNameAndPath = text.AllocLC(); TInt index = zipedFileNameAndPath->LocateReverse('\\'); if (index >= 0) { TPtrC path = zipedFileNameAndPath->Left(index + 1); iFs.MkDirAll(path); // errors are ok } if (zipedFileNameAndPath->Right(1).Compare(_L('\\')) != 0) { RFile file; CleanupClosePushL(file); file.Replace(iFs,*zipedFileNameAndPath,EFileWrite); User::LeaveIfError(file.Write(*buffer)); CleanupStack::PopAndDestroy(); // file } iUncompressedSize += member->UncompressedSize(); CleanupStack::PopAndDestroy(4); return ETrue; } else { return EFalse; } }
//--------------------------------------------------------------- // TestUniDataModelPlugin::createMMS //--------------------------------------------------------------- void TestUniDataModelMMSPlugin::createMMS(TMsvId pId, TBool subjectField) { TMsvEntry indexEntry; indexEntry.iType = KUidMsvMessageEntry; indexEntry.iMtm = KUidMsgTypeMultimedia; indexEntry.iServiceId = iServiceId; indexEntry.iDate.HomeTime(); // Convert TTime to QDateTime , this will be used for comparing the time of mesage // when fetched from datamodel TTime unixEpoch(KUnixEpoch); TTimeIntervalSeconds seconds; TTime timeStamp = indexEntry.iDate; timeStamp.SecondsFrom(unixEpoch, seconds); retTimeStamp.setTime_t(seconds.Int()); TMsvId parentId = pId; CMsvEntry* entry = CMsvEntry::NewL(*iMSession,parentId,TMsvSelectionOrdering()); CleanupStack::PushL(entry); entry->SetEntryL(parentId); entry->CreateL(indexEntry); entry->SetEntryL(indexEntry.Id()); iMmsClientMtm->SwitchCurrentEntryL(entry->EntryId()); CMsvStore* store = iMmsClientMtm->Entry().EditStoreL(); CleanupStack::PushL(store); //MMS Message ID Saved iMessageId = indexEntry.Id(); //Adding Subject if(subjectField) { QString subject(TEST_MSG_SUBJECT); HBufC* subj = XQConversions::qStringToS60Desc(subject); iMmsClientMtm->SetSubjectL(*subj); } //Adding Sender QString sender(TEST_MSG_FROM1); HBufC* addr = XQConversions::qStringToS60Desc(sender); if (addr) { CleanupStack::PushL(addr); TBuf<32> name; name.Copy(addr->Left(32)); indexEntry.iDetails.Set(name); iMmsClientMtm->SetSenderL(*addr); CleanupStack::PopAndDestroy(addr); } //Adding Recipient QString recipient(TEST_MSG_RECIEPIENT1); HBufC* addr2 = XQConversions::qStringToS60Desc(recipient); if (addr2) { CleanupStack::PushL(addr2); iMmsClientMtm->AddAddresseeL(EMsvRecipientTo,*addr2); CleanupStack::PopAndDestroy(addr2); } //Adding cCRecipient QString recipient2(TEST_MSG_RECIEPIENT2); HBufC* addr3 = XQConversions::qStringToS60Desc(recipient2); if (addr3) { CleanupStack::PushL(addr3); iMmsClientMtm->AddAddresseeL(EMsvRecipientCc,*addr3); CleanupStack::PopAndDestroy(addr3); } //Adding bCCRecipient QString recipient3(TEST_MSG_RECIEPIENT3); HBufC* addr4 = XQConversions::qStringToS60Desc(recipient3); if (addr4) { CleanupStack::PushL(addr4); iMmsClientMtm->AddAddresseeL(EMsvRecipientBcc,*addr4); CleanupStack::PopAndDestroy(addr4); } //Create Text Attachment TMsvAttachmentId attaId = 0; TFileName attachmentFile( _L("story.txt") ); TBufC<12> story = _L( "Hello world!" ); iMmsClientMtm->CreateTextAttachmentL(*store, attaId, story, attachmentFile, ETrue ); qDebug() << "Text Attachment id" << attaId; //Image Attachment added to the message entry RFile attaFile; // Set filename of attachment TFileName name( KPictureFileName ); CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL(); CleanupStack::PushL( mimeHeaders ); // Set values to mime headers mimeHeaders->SetContentTypeL( _L8( "image") ); mimeHeaders->SetContentSubTypeL( _L8( "jpeg" ) ); _LIT8(KMimeType, "image/jpeg"); TBufC8<10> mimeType(KMimeType); // CreateAttachment2L will set the content type to attachment Info // Open the attachment file for reading attaFile.Open( iFs, name, EFileShareReadersOnly | EFileRead ); CleanupClosePushL(attaFile); CMsvAttachment* attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // attaInfo ownerhip will be transferred to Attachment Manager. // It must not be pushed onto the cleanupStack before calling // CreateAttachment2L. iMmsClientMtm->CreateAttachment2L(*store, attaFile,mimeType,*mimeHeaders,attaInfo,attaId); qDebug() << "Image Attachment id" << attaId; // Now Attachment Manager owns the attaInfo CleanupStack::Pop(); // attaFile.Close() CleanupStack::PopAndDestroy(); // mimeHeaders store->CommitL(); CleanupStack::PopAndDestroy(store); // store iMmsClientMtm->SaveMessageL(); //Saving the message size for future checking msgSize = iMmsClientMtm->MessageSize(); CleanupStack::Pop(entry); // entry }
TInt CContactViewRangeBase::FindIndexL(const TDesC& aMatch,TCriteria aCriteria) const // Binary search through iView to find the first contact that matches aMatch according to aCritera. /** Called by implementations of SetL() to search the sub view's underlying view for the index of the first item whose field content matches aMatch, using the specified search criteria. @internalComponent @param aMatch The text to search for. @param aCriteria The search criteria. @return The index of the first matching item in the view. KErrNotFound if the view is empty or if none match. */ { const TInt NumberOfCharsToCompare=1; TInt result=KErrNotFound; TInt min=0; TInt max=iView.CountL()-1; if (max<0) { // The parent view is empty. return KErrNotFound; } TBool finished=EFalse; HBufC* sortableText; while (!finished) { TInt guess; if (max==min) { finished=ETrue; } guess=(max-min)/2+min; sortableText = iView.AllFieldsLC(guess,KNullDesC); TInt compare=sortableText->Left(NumberOfCharsToCompare).CompareC(aMatch.Left(NumberOfCharsToCompare),3,iCollateMethod); CleanupStack::PopAndDestroy();//sortableText switch (aCriteria) { case ELessThan: { if (compare>0 || compare==0) { // String is greater than aMatch. max=guess-1; if (max<min) { finished=ETrue; } } else if (compare<0) { // String is less than aMatch - could be a hit. min=guess+1; if (min>max) { finished=ETrue; } if (result==KErrNotFound || guess>result) { // guess is a closer match, so overwrite result. result=guess; } } break; } case ELessThanOrEqualTo: { if (compare>0) { // String is greater than aMatch. max=guess-1; if (max<min) { finished=ETrue; } } else if (compare<=0) { // String is less than or equal to aMatch - possible hit. min=guess+1; if (min>max) { finished=ETrue; } if (result==KErrNotFound || guess>result) { // guess is a closer match, so overwrite result. result=guess; } } break; } case EGreaterThan: { if (compare<0 || compare==0) { // String is less than aMatch. min=guess+1; if (min>max) { finished=ETrue; } } else if (compare>0) { // String is greater than aMatch - possible hit. max=guess-1; if (max<min) { finished=ETrue; } if (result==KErrNotFound || guess<result) { // guess is a closer match, so overwrite result. result=guess; } } break; } case EGreaterThanOrEqualTo: { if (compare<0) { // String is less than aMatch. min=guess+1; if (min>max) { finished=ETrue; } } else if (compare>=0) { // String is >= aMatch - possible hit. max=guess-1; if (max<min) { finished=ETrue; } if (result==KErrNotFound || guess<result) { // guess is a closer match, so overwrite result. result=guess; } } break; } }; } return result; }
// ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- // void CPosLmGpxParser::SetContentL( TPosXmlTagType aTag, const TDesC& aContent ) { switch (aTag) { // landmarkCollection Tags case EPosXmlLmCollName: AddCollectionDataL( EPosLmCollDataCollectionName, aContent ); break; case EPosXmlLmCollDescription: AddCollectionDataL( EPosLmCollDataCollectionDescription, aContent ); break; // landmark Tags case EPosXmlLandmark: { if ( !Math::IsNaN( iParsedLatitude ) && !Math::IsNaN( iParsedLongitude ) ) { TLocality loc( TCoordinate( iParsedLatitude, iParsedLongitude, iParsedAltitude), iParsedHorAcc, iParsedVertAcc); iWorkingLandmark->SetPositionL(loc); } TBuf<5> num; num.Num(iNoOfMediaLinks); iWorkingLandmark->SetPositionFieldL(EPositionFieldMediaLinks, num); // v1.0 media links if ( iReadUrl && iGpxVersion == EGpxVersion10 ) { SetContentL( EPosXmlLmMediaLink, KNullDesC ); } HandleLandmarkParsedL(); break; } case EPosXmlLmName: iWorkingLandmark->SetLandmarkNameL( aContent.Left( KPosLmMaxTextFieldLength ) ); break; case EPosXmlLmDescription: iWorkingLandmark->SetLandmarkDescriptionL( aContent.Left( KPosLmMaxDescriptionLength ) ); break; case EPosXmlLmDescription2: iWorkingLandmark->SetPositionFieldL( EPositionFieldComment, aContent.Left( KPosLmMaxTextFieldLength ) ); break; case EPosXmlCoordAltitude: PosLmConverterUtils::DesToRealL(aContent, iParsedAltitude); break; case EPosXmlCoordHorizontalAcc: PosLmConverterUtils::DesToRealL(aContent, iParsedHorAcc); // Ensure horizontal acc is >= 0 PosLmConverterUtils::AssertL( iParsedHorAcc >= 0 || Math::IsNaN( iParsedHorAcc ) ); iParsedHorAcc *= KPosLmDopToAccuracyFactor; break; case EPosXmlCoordVerticalAcc: PosLmConverterUtils::DesToRealL( aContent, iParsedVertAcc ); // Ensure vertical acc is >= 0 PosLmConverterUtils::AssertL( iParsedVertAcc >= 0 || Math::IsNaN( iParsedVertAcc ) ); iParsedVertAcc *= KPosLmDopToAccuracyFactor; break; // mediaLink Tag case EPosXmlMediaLinkUrl: PosLmConverterUtils::AssertL( PosLmConverterUtils::IsAnyUri( aContent ) ); iReadUrl = aContent.AllocL(); break; case EPosXmlMediaLinkMime: iReadMimeType = aContent.AllocL(); break; case EPosXmlLmMediaLink: { HBufC* mediaLink = PosLmConverterUtils::ConcatenateMediaLinkLC( *iReadMimeType, *iReadUrl ); iWorkingLandmark->SetPositionFieldL(static_cast<TPositionFieldId> (EPositionFieldMediaLinksStart + iNoOfMediaLinks), mediaLink->Left(KPosLmMaxTextFieldLength)); iNoOfMediaLinks++; CleanupStack::PopAndDestroy(mediaLink); delete iReadMimeType; iReadMimeType = NULL; delete iReadUrl; iReadUrl = NULL; break; } // category Tags case EPosXmlCategoryName: PosLmImplExtension::SetCategoryIdL( *iWorkingCategory, iWorkingItemId ); PosLmConverterUtils::AssertL( aContent.Length() > 0 ); iWorkingCategory->SetCategoryNameL( aContent.Left( KPosLmMaxCategoryNameLength ) ); iWorkingLandmark->AddCategoryL( iWorkingItemId++ ); User::LeaveIfError( iCategories.Append( iWorkingCategory ) ); iWorkingCategory = NULL; break; // Attributes case EPosXmlCoordLatitude: // WayPoint attribute PosLmConverterUtils::DesToRealL(aContent, iParsedLatitude); // Ensure latitude is in valid range PosLmConverterUtils::AssertL( (iParsedLatitude <= KPosLmParserMaxLatitude && iParsedLatitude >= KPosLmParserMinLatitude) || Math::IsNaN(iParsedLatitude)); break; case EPosXmlCoordLongitude: // WayPoint attribute PosLmConverterUtils::DesToRealL(aContent, iParsedLongitude); // Ensure latitude is in valid range PosLmConverterUtils::AssertL( (iParsedLongitude <= KPosLmParserMaxLongitude && iParsedLongitude >= KPosLmParserMinLongitude) || Math::IsNaN(iParsedLongitude)); break; case EPosXmlVersion: if ( aContent.Compare( KPosXmlVersionNum10 ) == 0 ) { iGpxVersion = EGpxVersion10; } else // anything else is used as 1.1 { iGpxVersion = EGpxVersion11; } break; default: break; } }
void CHandleOutSearch::HandleChildElement(TiXmlNode* aElement) { TInt index=iPointArray.Count()-1; TInt itemIndex=iPointArray[index]->GetItemCount()-1; if(itemIndex<0) { iPointArray[index]->CreatNewItem(); itemIndex=0; } if(aElement->NoChildren()) { if(iFlag) { HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->Value())); CleanupStack::PushL(buf); if(buf->Compare(_L("br"))==0) { if(!iPointArray[index]->GetItem(itemIndex).IsNull()) iPointArray[index]->CreatNewItem(); } if(buf->Compare(_L("br"))!=0&&buf->Compare(_L("img"))!=0&&buf->Compare(_L("input"))!=0&&buf->Compare(_L("|"))!=0) { if(buf->Left(2).Compare(_L("--"))==0) { TInt f=0; for(TInt i=0;i<buf->Length();i++) { if(buf->Mid(i,1).Compare(_L("-"))!=0) { f=1; break; } } if(f==0) { iFlag=EFalse; } } if(iFlag) iPointArray[index]->GetItem(itemIndex).SetName(*buf); else { if(!iPointArray[index]->GetItem(itemIndex).IsNull()) iPointArray[index]->CreatNewItem(); } } iMainEngine.WriteLog16(*buf); CleanupStack::PopAndDestroy(1); } } else { HBufC8* tag=TPtrC8((const TUint8*)aElement->Value()).Alloc(); CleanupStack::PushL(tag); TInt value=CheckTag(*tag); CleanupStack::PopAndDestroy(1); if(value>0) { switch(value) { case 1: //P±êÇ© { TiXmlNode* element=aElement->FirstChild(); while(element!=0) { HandleChildElement(element); element=element->NextSibling(); } } break; case 2: //Á¬½Ó±êÇ© { HBufC8* bufUrl = TPtrC8((const TUint8*)aElement->ToElement()->Attribute("href")).Alloc(); CleanupStack::PushL(bufUrl); TInt urlFlag=CheckUrl(*bufUrl); if(urlFlag>0) { iPointArray[index]->GetItem(itemIndex).SetUrl(*bufUrl); } CleanupStack::PopAndDestroy(1); if(urlFlag==1||urlFlag==2) { HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->FirstChild()->Value())); CleanupStack::PushL(buf); iPointArray[index]->GetItem(itemIndex).SetName(*buf); iMainEngine.WriteLog16(*buf); CleanupStack::PopAndDestroy(1); iPointArray[index]->GetItem(itemIndex).SetIsLink(ETrue); iPointArray[index]->CreatNewItem(); } else { HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->FirstChild()->Value())); CleanupStack::PushL(buf); HBufC8* bufUrl = TPtrC8((const TUint8*)aElement->ToElement()->Attribute("href")).Alloc(); CleanupStack::PushL(bufUrl); if(CheckUrl(*bufUrl)==3) { if(buf->Compare(iMainEngine.GetDesById(ETurkeyTextRes_DownPage))==0||buf->Compare(iMainEngine.GetDesById(ETurkeyTextRes_HXML_DPage))==0) { iPointArray[index]->SetNextPageUrl(*bufUrl); } else if(buf->Compare(iMainEngine.GetDesById(ETurkeyTextRes_UpPage))==0||buf->Compare(iMainEngine.GetDesById(ETurkeyTextRes_HXML_UPage))==0) { iPointArray[index]->SetPrePageUrl(*bufUrl); } } iMainEngine.WriteLog16(*buf); CleanupStack::PopAndDestroy(2); } } break; case 4://»»ÐбêÇ© if(!iPointArray[index]->GetItem(itemIndex).IsNull()&&iFlag) iPointArray[index]->CreatNewItem(); break; case 3://×ÖÌå±êÇ© { if(iFlag) { HBufC* buf = CnvUtfConverter::ConvertToUnicodeFromUtf8L(TPtrC8((const TUint8*)aElement->FirstChild()->Value())); CleanupStack::PushL(buf); iPointArray[index]->GetItem(itemIndex).SetName(*buf); iMainEngine.WriteLog16(*buf); CleanupStack::PopAndDestroy(1); } } break; } } } }
void CSysApConfirmationQuery::ShowQueryL( const TSysApConfirmationQueryIds aQueryId, const TDesC& /*aValue*/, CCoeEnv* aLoaderEnv ) #endif // RD_MULTIPLE_DRIVE { TRACES( RDebug::Print( _L("CSysApConfirmationQuery::ShowQueryL( %d )"), aQueryId ) ); HBufC* queryStringBuf = NULL; HBufC* deviceNameBuf = NULL; CAknQueryDialog::TTone tone = CAknQueryDialog::ENoTone; if( !IsActive() ) { iQueryId = aQueryId; TInt secondaryDisplayCmdId(SecondaryDisplay::ECmdNoNote); TInt keys(0); TInt anim(0); switch ( iQueryId ) { case ESysApRestartPhoneQuery: queryStringBuf = StringLoader::LoadLC( R_QTN_RESTART_QUERY, aLoaderEnv ); keys = R_AVKON_SOFTKEYS_OK_EMPTY; anim = R_QGN_NOTE_WARNING_ANIM; secondaryDisplayCmdId = SecondaryDisplay::ECmdShowRestartPhoneQuery; break; case ESysApLeaveOfflineModeQuery: queryStringBuf = StringLoader::LoadLC( R_QTN_LEAVE_OFFLINE_MODE_QUERY, aLoaderEnv ); keys = R_AVKON_SOFTKEYS_YES_NO; secondaryDisplayCmdId = SecondaryDisplay::ECmdShowLeaveOfflineModeQuery; break; #ifndef RD_MULTIPLE_DRIVE case ESysApRemoveMmcNote: queryStringBuf = StringLoader::LoadLC( R_QTN_MEMC_INFO_EJECT, aLoaderEnv ); keys = R_AVKON_SOFTKEYS_OK_EMPTY; anim = R_QGN_NOTE_INFO_ANIM; secondaryDisplayCmdId = SecondaryDisplay::ECmdShowRemoveMmcQuery; break; case ESysApEjectMmcQuery: queryStringBuf = StringLoader::LoadLC( R_QTN_MEMC_CONF_EJECT, aLoaderEnv ); keys = R_AVKON_SOFTKEYS_YES_NO; secondaryDisplayCmdId = SecondaryDisplay::ECmdShowEjectMmcQuery; break; #else // RD_MULTIPLE_DRIVE case ESysApRemoveMmcNote: queryStringBuf = aValue.AllocLC(); keys = R_AVKON_SOFTKEYS_OK_EMPTY; anim = R_QGN_NOTE_INFO_ANIM; secondaryDisplayCmdId = SecondaryDisplay::ECmdShowRemoveMmcQuery; break; case ESysApEjectMmcQuery: queryStringBuf = aValue.AllocLC(); keys = R_AVKON_SOFTKEYS_YES_NO; secondaryDisplayCmdId = SecondaryDisplay::ECmdShowEjectMmcQuery; break; #endif // RD_MULTIPLE_DRIVE case ESysApBtSapDisconnectQuery: deviceNameBuf = iSysApAppUi.GetBtSapDeviceNameL(); if ( deviceNameBuf ) { CleanupStack::PushL(deviceNameBuf); queryStringBuf = StringLoader::LoadL( R_QTN_BT_DISCONN_FROM, *deviceNameBuf, aLoaderEnv ); } else { queryStringBuf = StringLoader::LoadL( R_QTN_BT_DISCONN_FROM, KEmptyString, aLoaderEnv ); } CleanupStack::PushL(queryStringBuf); keys = R_AVKON_SOFTKEYS_YES_NO; secondaryDisplayCmdId = SecondaryDisplay::ECmdShowBtSapDisconnectQuery; break; case ESysApMemoryCardLockedNote: iPendingQuery = ESysApMemoryCardLockedNote; queryStringBuf = StringLoader::LoadLC( R_QTN_MEMC_LOCKED_NOT_SUPPORTED, aLoaderEnv ); keys = R_AVKON_SOFTKEYS_OK_EMPTY; anim = R_QGN_NOTE_INFO_ANIM; secondaryDisplayCmdId = SecondaryDisplay::ECmdShowMemoryCardLockedQuery; break; /* case ESysApUseFmTxInOfflineQuery: queryStringBuf = StringLoader::LoadLC( R_QTN_FMTX_SYSAP_NOTE_ACTIVATE_IN_OFFLINE, aLoaderEnv ); keys = R_AVKON_SOFTKEYS_YES_NO; secondaryDisplayCmdId = SecondaryDisplay::ECmdShowFmTxKeepOnInOfflineQuery; break; */ case ESysApBattChargingPowerSavingQuery: queryStringBuf = StringLoader::LoadLC( R_QTN_BATTERY_CHARGING_POWER_SAVING_QUERY, aLoaderEnv ); keys = R_AVKON_SOFTKEYS_YES_NO; secondaryDisplayCmdId = SecondaryDisplay::ECmdShowChargingDeactivatePowerSavingQuery; tone = static_cast<CAknQueryDialog::TTone>( EAvkonSIDChargingBatteryTone ); break; case ESysApBattLowPowerSavingQuery: queryStringBuf = StringLoader::LoadLC( R_QTN_BATTERY_CONF_QUERY, aLoaderEnv ); keys = R_AVKON_SOFTKEYS_YES_NO; secondaryDisplayCmdId = SecondaryDisplay::ECmdShowBattLowActivatePowerSavingQuery; break; default: break; } if ( iSysApAppUi.CoverDisplaySupported() && secondaryDisplayCmdId != SecondaryDisplay::ECmdNoNote ) { TRACES( RDebug::Print( _L("CSysApConfirmationQuery::ShowQueryL - Notifying secondary display") ) ); CAknSDData* sd = NULL; if ( secondaryDisplayCmdId == SecondaryDisplay::ECmdShowBtSapDisconnectQuery ) { SecondaryDisplay::TDeviceName sdDeviceName; sdDeviceName.Append(deviceNameBuf->Left(SecondaryDisplay::KMaxDeviceNameLen)); SecondaryDisplay::TBtSapDisconnectQueryPckg pckg(sdDeviceName); sd = CAknSDData::NewL(SecondaryDisplay::KCatSysAp, SecondaryDisplay::ECmdShowBtSapDisconnectQuery, pckg); } else { sd = CAknSDData::NewL(SecondaryDisplay::KCatSysAp, secondaryDisplayCmdId, KNullDesC8); } iQuery->SetSecondaryDisplayData(sd); // ownership to notifier client } if ( keys && queryStringBuf ) { if ( anim ) { iQuery->ShowConfirmationQueryL( iStatus, queryStringBuf->Des(), keys, anim, KNullDesC, 0, 0, tone ); } else { iQuery->ShowConfirmationQueryL( iStatus, queryStringBuf->Des(), keys, 0, KNullDesC, 0, 0, tone ); } } SetActive(); } else { // If another query is wanted when ESysApMemoryCardLockedNote is active, override it (Continues in RunL which handles cancel). if ( iQueryId == ESysApMemoryCardLockedNote && aQueryId != ESysApMemoryCardLockedNote ) { iPendingQuery = aQueryId; iQuery->CancelConfirmationQuery(); } } if ( queryStringBuf ) { CleanupStack::PopAndDestroy( queryStringBuf ); // queryStringbuf } if ( deviceNameBuf ) { CleanupStack::PopAndDestroy( deviceNameBuf ); // deviceNameBuf } }
void CCmdIniEdit::DoRunL() { TBool interactive = ETrue; if (iForce) { iReader = CIniReader::NewL(iIniFile); } else { iReader = CIniFile::NewL(iIniFile, iDescriptionFile); } TBool updated = EFalse; if (iSet) { TInt eqPos = iSet->Find(KEquals); TPtrC value(KNullDesC); TPtrC id(KNullDesC); if (eqPos == KErrNotFound) { id.Set(*iSet); Stdin().SetReadModeL(RIoReadHandle::ELine); iBuf.CreateL(0x100); Stdin().ReadL(iBuf); value.Set(iBuf); } else { id.Set(iSet->Left(eqPos)); value.Set(iSet->Mid(eqPos+1)); } iReader->SetValueL(Trim(id), value); updated = ETrue; interactive = EFalse; } if (iRemove) { iReader->RemoveValueL(*iRemove); updated = ETrue; interactive = EFalse; } if (iGet) { const TDesC* value = iReader->GetValue(*iGet); if (!value) LeaveIfErr(KErrNotFound, _L("id '%S' not found in %S"), iGet, &iIniFile); Write(*value); interactive = EFalse; } else if (iDump) { RPointerArray<CValue> values; CleanupClosePushL(values); iReader->GetValuesL(values); for (TInt i=0; i<values.Count(); ++i) { if (iForce) { Printf(_L("%S: %S\n"), &values[i]->Id(), &values[i]->Value()); } else { CSetting* setting = (CSetting*)values[i]; Printf(_L("%S: %S\n"), &setting->Name(), &setting->Value()); } } CleanupStack::PopAndDestroy(&values); interactive = EFalse; } if (interactive) { // TODO enter interactive mode LeaveIfErr(KErrNotSupported, _L("Interactive mode not implemented yet.")); } if (updated) { WriteIniFileL(iIniFile, *iReader); } }