/** Get the sequence of all active transforms, ordered in order of execution. @param aTransformSequence an empty array to be populated with sequence of transform UIDs, where transform entries with smaller index are executed earlier. @leave KErrNoMemory Out of memory. */ EXPORT_C void CCamera::CCameraImageProcessing::GetActiveTransformSequenceL(RArray<TUid>& aTransformSequence) const { iImpl->GetActiveTransformSequenceL(aTransformSequence); /* if CCamera::New2L() or CCamera::NewDuplicate2L() is not used to create CCamera object, it is assumed that application is not prepared to receive extra added uid values (new settings added). So, any extra uid value passed from the implementation will be filtered at this point. To receive extra added uid values, application should rather use CCamera::New2L() or CCamera::NewDuplicate2L() to create camera object. In this case, application is assumed to be prepared to receive unrecognised uid values */ if(iOwner.CameraVersion() == KCameraDefaultVersion) { for(TInt index =0; index < aTransformSequence.Count(); index++) { /** KBaselinedImageProcessing is the baseline. Any image processing attribute with greater uid value means that it has been added in later versions */ if(aTransformSequence[index].iUid > KBaselinedImageProcessing) { aTransformSequence.Remove(index); index--; } } } }
// ----------------------------------------------------------------------------- // Cimcache_test::GetChatListTestL // Example test method function. // (other items were commented in a header). // ----------------------------------------------------------------------------- // TInt Cimcache_test::GetChatListTestL( CStifItemParser& /*aItem*/) { TInt error = KErrGeneral; CIMCacheFactory* instance = CIMCacheFactory::InstanceL(); MIMCacheUpdater* updater = instance->CreateUpdaterL(1, _L("*****@*****.**"), EFalse ); updater->AppendReceiveMessageL( _L("*****@*****.**"),_L("hello this is new message notification 1 ") ) ; updater->AppendReceiveMessageL( _L("*****@*****.**"),_L("hello this is new message notification 2 ") ) ; updater->AppendReceiveMessageL( _L("*****@*****.**"),_L("hello this is new message notification 3 ") ) ; RArray<SIMCacheChatItem> listArray = updater->GetChatListL( 1 ); if( listArray.Count() == 3 ) // total 3 chat created in server { error = KErrNone; } CIMCacheFactory::Release(); return error; }
EXPORT_C TInt RDirectPrintClient::SetNumberOfCopies( const RArray<TInt>& aArray ) const { LOG("RDirectPrintClient::SetNumberOfCopies EReserveEngine"); TInt err = SendReceive( EReserveEngine ); LOG1("RDirectPrintClient::SetNumberOfCopies EReserveEngine err: %d", err); if( !err ) { TInt count = aArray.Count(); LOG1("RDirectPrintClient::SetNumberOfCopies count: %d", count); LOG("RDirectPrintClient::SetNumberOfCopies ESetNumberOfCopiesCount"); err = SendReceive( ESetNumberOfCopiesCount, TIpcArgs( count ) ); LOG1("RDirectPrintClient::SetNumberOfCopies ESetNumberOfCopiesCount err: %d", err); for( TInt i = 0; i < count && !err; i++ ) { LOG1("RDirectPrintClient::SetNumberOfCopies i: %d", i); LOG("RDirectPrintClient::SetNumberOfCopies ESetNumberOfCopies"); err = SendReceive( ESetNumberOfCopies, TIpcArgs( aArray[i] ) ); LOG1("RDirectPrintClient::SetNumberOfCopies ESetNumberOfCopies err: %d", err); } } LOG1("RDirectPrintClient::SetNumberOfCopies end with: %d", err); return err; }
// --------------------------------------------------------------------------- // CLbtAppChangeHandler::HandleAppListAdditionEvent // --------------------------------------------------------------------------- // void CLbtAppChangeHandler::HandleAppListAdditionEvent(RArray<TLbtAppInfo>& aNewAppList) { FUNC_ENTER("CLbtAppChangeHandler::HandleAppListAdditionEvent"); // Check which all app(s) have been added back for(TInt i=0;i<aNewAppList.Count();++i) { TInt index = FindElementInArray(iCurrentInstalledApps, aNewAppList[i]); if(KErrNotFound == index) { // This application has been added TLbtAppInfo appInfo = aNewAppList[i]; if( appInfo.iFullName.FindC( iMMCDriveChar ) >= 0 ) { // Append to the array only if the application resides on the MMC TInt error = iAppList.Append( appInfo ); if( error != KErrNone ) { LOG1("Failed to append appInfo to the array:%d",error); return; } } } } if(iAppList.Count() > 0) { TRAPD(error, SetValidTriggersOfApplicationsL()); if(error != KErrNone) { ERROR("SetValidTriggersOfApplicationsL error = %d", error); iAppList.Close(); iOperation = EOpNone; } } }
// --------------------------------------------------------------------------- // Walk through all the sevices and check there is any service match // --------------------------------------------------------------------------- // TBool CSPSettingsEngine::CheckFeatureL( TInt aMask, TInt aValue ) { RArray<TInt> entryIds; CleanupClosePushL( entryIds ); iCenRepUtils->FindEntryIdsL( entryIds ); CCenRepDatabaseProperty* property = CCenRepDatabaseProperty::NewLC(); TBool ret = EFalse; for( TInt i = 0; i < entryIds.Count(); i++ ) { TInt entryId = entryIds[i]; if( entryId == KSPDefaultVoIPServiceId ) { continue; } TInt retProperty = iCenRepUtils->FindPropertyL( entryId, EPropertyServiceAttributeMask, *property ); if( retProperty == KErrNone ) { TInt maskValue = 0; TInt err = property->GetValue( maskValue ); if( err == KErrNone ) { if( ( maskValue & aMask ) == (aValue & aMask) ) { // Find matched servcie ret = ETrue; break; } } } } CleanupStack::PopAndDestroy( property ); CleanupStack::PopAndDestroy( &entryIds ); return ret; }
/** * Reads data specified in the ini file and constructs all relevant view update objects * These view update objects serve as source for performing underlying view update operations */ void CTestContactViewUnderlyingViewUpdateStep::ReadIniAndConstructViewUpdateObjectsL() { _LIT(KListOfViewsToBeRemoved, "ListOfViewsToBeUpdated"); TPtrC listOfViewsToBeUpdated; TESTL(GetStringFromConfig(ConfigSection(), KListOfViewsToBeRemoved, listOfViewsToBeUpdated)); RArray<TPtrC> sections; CleanupClosePushL(sections); ViewUtilityReference().TokenizeStringL(listOfViewsToBeUpdated, sections); for ( TInt i = 0; i < sections.Count(); ++i ) { TViewModificationData viewModificationData; // Here data is read from the ini file about various contact view update operations // to be performed. This information comprises of view to be updated and number of contacts // to be removed in the specified view _LIT(KContactViewType, "ViewType"); TPtrC contactViewTypeString; GetStringFromConfig(sections[i], KContactViewType, contactViewTypeString); viewModificationData.SetViewType(contactViewTypeString); _LIT(KContactViewIndex, "ViewIndex"); TInt contactViewIndex; GetIntFromConfig(sections[i], KContactViewIndex, contactViewIndex); viewModificationData.SetViewIndex(contactViewIndex); _LIT(KNumberOfContactToBeRemoved, "NumberOfContactsToBeRemoved"); TInt numberOfContactsToBeRemoved; GetIntFromConfig(sections[i], KNumberOfContactToBeRemoved, numberOfContactsToBeRemoved); viewModificationData.SetNumberOfContactsToBeRemoved(numberOfContactsToBeRemoved); iViewUpdateArray.AppendL(viewModificationData); } CleanupStack::PopAndDestroy(§ions); }
// --------------------------------------------------------------------------- // Goes through phone supported paper size values and compare with printer supported, // if both supported save value // --------------------------------------------------------------------------- void CCapabilityManager::StorePaperSizeL(RArray<TUint>& aPrinterPaperSize) { FLOG(_L("[IMAGEPRINTUI]<<< CCapabilityManager: Store paper size")); TInt countPrinter, countPhone; TUint compareValue; countPrinter = aPrinterPaperSize.Count(); countPhone = iPhoneSuppPaperSize.Count(); iIsCapabilityEmpty = EFalse; iCurrentPaperSizes.Reset(); FTRACE(FPrint(_L("[IMAGEPRINTUI]\t CCapabilityManager aPrinterPaperSize count is %d"), aPrinterPaperSize.Count() )); FTRACE(FPrint(_L("[IMAGEPRINTUI]\t CCapabilityManager iPhoneSuppPaperSize count is %d"), iPhoneSuppPaperSize.Count() )); for(int r=0; r < countPrinter; r++) { compareValue = aPrinterPaperSize[r]; for(int f=0; f < countPhone; f++) { if(compareValue == iPhoneSuppPaperSize[f]) { iIsCapabilityEmpty = ETrue; FTRACE(FPrint(_L("[IMAGEPRINTUI]\t CCapabilityManager compareValue save paper size is %x"), compareValue )); iCurrentPaperSizes.AppendL(compareValue); } } } if(!iIsCapabilityEmpty) { FLOG(_L("[IMAGEPRINTUI]<<< CCapabilityManager: paper size add default value")); iCurrentPaperSizes.AppendL(EDpsPaperSizeDefault); } FLOG(_L("[IMAGEPRINTUI]<<< CCapabilityManager: paper sizes stored, ask quality")); iCurrentPaperSizes.Sort(); AskQualityL(); }
void CCapabilityManager::StoreQualitiesL(RArray<TUint>& aPrinterQualities) { FLOG(_L("[IMAGEPRINTUI]<<< CCapabilityManager: Store qualities")); TInt countPrinter, countPhone; TUint compareValue; countPrinter = aPrinterQualities.Count(); countPhone = iPhoneSuppQuality.Count(); iIsCapabilityEmpty = EFalse; iCurrentQualities.Reset(); FTRACE(FPrint(_L("[IMAGEPRINTUI]\t CCapabilityManager aPrinterQualities count is %d"), aPrinterQualities.Count() )); FTRACE(FPrint(_L("[IMAGEPRINTUI]\t CCapabilityManager iPhoneSuppQuality count is %d"), iPhoneSuppQuality.Count() )); for(int r=0; r < countPrinter; r++) { compareValue = aPrinterQualities[r]; for(int d=0; d < countPhone; d++) { if(compareValue == iPhoneSuppQuality[d]) { iIsCapabilityEmpty = ETrue; FTRACE(FPrint(_L("[IMAGEPRINTUI]\t CCapabilityManager compareValue save quality is %x"), compareValue )); iCurrentQualities.AppendL(compareValue); } } } if(!iIsCapabilityEmpty) { FLOG(_L("[IMAGEPRINTUI]<<< CCapabilityManager: qualities add default value")); iCurrentQualities.AppendL(EDpsPrintQualityDefault); } FLOG(_L("[IMAGEPRINTUI]<<< CCapabilityManager: qualities stored, ask layout")); iCurrentQualities.Sort(); AskLayoutL(); }
// --------------------------------------------------------------------------- // Search stored service IDs of service provider settings entries // --------------------------------------------------------------------------- // TInt CSPSettingsEngine::FindServiceIdsL( RIdArray& aServiceIds ) { XSPSLOGSTRING( "CSPSettingsEngine::FindServiceIdsL() - IN" ); RArray<TInt> cenrepArray; CleanupClosePushL( cenrepArray ); TInt err = iCenRepUtils->FindEntryIdsL( cenrepArray ); for( TInt i = 0; i < cenrepArray.Count(); i++ ) { TServiceId id = (TServiceId)cenrepArray[i]; if( id != KSPDefaultVoIPServiceId ) { User::LeaveIfError( aServiceIds.Append( id )); } } CleanupStack::PopAndDestroy( &cenrepArray ); XSPSLOGSTRING( "CSPSettingsEngine::FindServiceIdsL() - OUT" ); return err; }
// ----------------------------------------------------------------------------- // CTCStateTiltListenData::Average // ----------------------------------------------------------------------------- // // Calculate average for array static void Average( const RArray<TTiltXYZValue>& aArray, TInt16& aAveX, TInt16& aAveY, TInt16& aAveZ ) { FUNC_LOG; TInt aveX = 0; TInt aveY = 0; TInt aveZ = 0; TInt count = aArray.Count(); TInt i = 0; while( i < count ) { const TTiltXYZValue& val = aArray[ i++ ]; aveX += val.iX; aveY += val.iY; aveZ += val.iZ; } if( count ) { aAveX = aveX / count; aAveY = aveY / count; aAveZ = aveZ / count; } }
void CPlayerApplicationSettings::ConstructL(TUint aAttributeID, TDesC8& aAttributeText, const RArray<TUint>& aValues, RArray<TPtrC8>& aValueText, TUint aInitialValue ) { iAttributeID = aAttributeID; // copy the attribute description iAttributeText = aAttributeText.AllocL(); // copy the allowed values for (TInt i=0; i < aValues.Count(); i++ ) { // avoid duplicated defined values if (iValues.Find(aValues[i]) != KErrNotFound) { User::Leave(KErrArgument); } iValues.AppendL( aValues[i] ); // copy the value description into a HBuf and add pointer to iValueTexts HBufC8 * valueText = aValueText[i].AllocL(); CleanupStack::PushL(valueText); iValueText.AppendL(valueText); CleanupStack::Pop(valueText); } TInt error = SetCurrentValue( aInitialValue ); if ( error != KErrNone ) { User::Leave( error ); } }
void CImagePresentObserver::HandleObjectPresentNotification(CMdESession& /*aSession*/, TBool aPresent, const RArray<TItemId>& aObjectIdArray) { WRITELOG( "CImagePresentObserver::HandleObjectPresentNotification" ); if ( aPresent ) { WRITELOG( "CImagePresentObserver::HandleObjectPresentNotification - objects present" ); if ( !iStarted ) { CMdEObjectDef* imageObjDef = NULL; TRAP_IGNORE( imageObjDef = &iDefaultNamespace->GetObjectDefL( MdeConstants::Image::KImageObject )); iPendingCount = iMdEHarvesterSession->GetPendingCount( imageObjDef ); SetNextRequest( ERequestWaitPendingCount ); iStarted = ETrue; } TInt count = aObjectIdArray.Count(); for (TInt i = 0; i < count; i++ ) { iPresentObjectIds.Append( aObjectIdArray[i] ); } } }
EXPORT_C void RMemSpySession::GetMemoryTrackingCyclesL(RArray<CMemSpyApiMemoryTrackingCycle*>& aCycles) { TPckgBuf<TInt> count; User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetMemoryTrackingCycleCount, TIpcArgs(&count) )); TInt requestedCount = count(); HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyMemoryTrackingCycleData)); TPtr8 bufferPtr(buffer->Des()); TIpcArgs args( &count, &bufferPtr ); User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetMemoryTrackingCycles, args )); aCycles.Reset(); for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyMemoryTrackingCycleData)) { TPckgBuf<TMemSpyMemoryTrackingCycleData> data; data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyMemoryTrackingCycleData)); aCycles.AppendL(CMemSpyApiMemoryTrackingCycle::NewLC(data())); } CleanupStack::Pop(aCycles.Count()); CleanupStack::PopAndDestroy(buffer); }
EXPORT_C void RMemSpySession::GetKernelObjectItemsL( RArray<CMemSpyApiKernelObjectItem*> &aKernelObjectItems, TMemSpyDriverContainerType aForContainer ) { TPckgBuf<TInt> count; TPckgBuf<TMemSpyDriverContainerType> type(aForContainer); User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectItemCount, TIpcArgs(&count, &type) )); TInt requestedCount = count(); HBufC8* buffer = HBufC8::NewLC(requestedCount * sizeof(TMemSpyDriverHandleInfoGeneric)); TPtr8 bufferPtr(buffer->Des()); TIpcArgs args( &count, &type, &bufferPtr ); User::LeaveIfError(SendReceive( EMemSpyClientServerOpGetKernelObjectItems, args )); aKernelObjectItems.Reset(); for(TInt i=0, offset = 0; i<requestedCount; i++, offset+=sizeof(TMemSpyDriverHandleInfoGeneric)) { TPckgBuf<TMemSpyDriverHandleInfoGeneric> data; data.Copy(bufferPtr.Ptr()+offset, sizeof(TMemSpyDriverHandleInfoGeneric)); aKernelObjectItems.AppendL( CMemSpyApiKernelObjectItem::NewLC( data() ) ); } CleanupStack::Pop(aKernelObjectItems.Count()); CleanupStack::PopAndDestroy(buffer); }
// ------------------------------------------------ // NotifyRelationPresent // ------------------------------------------------ // void CMdSNotifier::NotifyRelationPresent(TBool aPresent, const RArray<TItemId>& aRelationIds) { if (aRelationIds.Count() == 0) { return; } for( TInt i = iEntries.Count() - 1; i >=0; i-- ) { TEntry& e = iEntries[i]; // No condition matching, relation present changes // are always notified to relation present observers if( e.iType & ( ERelationNotifyPresent | ERelationNotifyNotPresent ) ) { const TMdSObserverNotificationType relationState = aPresent ? ERelationNotifyPresent : ERelationNotifyNotPresent; RPointerArray<HBufC> nullArray; // For when uris are not needed if( e.IsPending() ) { // match found. trigger notifier entry ! TRAPD( err, e.TriggerL( relationState, aRelationIds, nullArray ) ); if( err != KErrNone ) { e.TriggerError( err ); } } else { TRAP_IGNORE( e.CacheL( relationState, aRelationIds, nullArray ) ); } nullArray.Close(); } } }
// ----------------------------------------------------------------------------- // GetAPIDFromDBorSNAPL // ----------------------------------------------------------------------------- // LOCAL_C TUint GetAPIDFromDBorSNAPL(TDesC& aOrig) { FLOG( _L( "[Provisioning] WPAdapterUtil GetAPIDFromDBorSNAPL" ) ); RArray<TAccessPointItem> AccessPointItem; RArray<TAccessPointItem> AccessPointItem2; CWPInternetAPDB *db = CWPInternetAPDB::NewLC(); RCmConnectionMethodExt connection; RCmManagerExt cmManager; cmManager.OpenL(); CleanupClosePushL( cmManager ); if (aOrig.Length()) { //Read the Accesspoint data from DB, for the same originator db->ReadDbItemsForOrigL(AccessPointItem, aOrig); } //Read the Accesspoint data from DB, for all originators db->ReadDbItemsL(AccessPointItem2); TInt APOrigCount = AccessPointItem.Count(); TInt APCount = AccessPointItem2.Count(); //Valid APID of same originator TBool APIDofSameOrig = EFalse; //Valid APID of same originator TBool APIDofOtherOrig = EFalse; //HBufC *AccessPointName = NULL; TUint apid = 0; TUint apid1; if (APOrigCount) { TInt i; for ( i = APOrigCount - 1; i >= 0; i-- ) { apid1 = AccessPointItem[i].iAPID; TRAPD(err, connection = cmManager.ConnectionMethodL(apid1)); if (err == KErrNone) { CleanupClosePushL( connection ); if (AccessPointItem[i].iBearerType == connection.GetIntAttributeL(ECmBearerType)) { //Valid access point of same originator is found APIDofSameOrig = ETrue; apid = apid1; CleanupStack::PopAndDestroy(); break; } CleanupStack::PopAndDestroy(); } } //No valid access points of same originator //Get Access Point which is of other originator if(!APIDofSameOrig) { TInt j; TBool InvalidAPIDofOrig; for (i = APCount - 1; i >= 0; i-- ) { apid1 = AccessPointItem2[i].iAPID; for (InvalidAPIDofOrig = EFalse, j = APOrigCount - 1; j >= 0; j-- ) { if(apid1 == AccessPointItem[j].iAPID) { InvalidAPIDofOrig = ETrue; break; } } TRAPD(err, connection = cmManager.ConnectionMethodL(apid1)); if (err == KErrNone) { CleanupClosePushL( connection ); if (!j && !InvalidAPIDofOrig && AccessPointItem2[i].iBearerType == connection.GetIntAttributeL(ECmBearerType)) { //Valid access point of Other originator is found APIDofOtherOrig = ETrue; apid = apid1; CleanupStack::PopAndDestroy(); //connection break; } CleanupStack::PopAndDestroy(); //connection } } } } //No access points of same originator and valid //Get Access Point of other originator if (APCount && !APIDofSameOrig && !APIDofOtherOrig) { for (TInt i = APCount - 1; i >= 0; i-- ) { apid1 = AccessPointItem2[i].iAPID; TRAPD(err, connection = cmManager.ConnectionMethodL(apid1)); if (err == KErrNone) { CleanupClosePushL( connection ); if ( AccessPointItem2[i].iBearerType == connection.GetIntAttributeL(ECmBearerType)) { APIDofOtherOrig = ETrue; apid = apid1; CleanupStack::PopAndDestroy(); //connection break; } CleanupStack::PopAndDestroy(); //connection } } } //No valid access points of same originator and other originators //Get Access Point from Internet SNAP if (!APIDofSameOrig && !APIDofOtherOrig) { //Implementation to get the latest APID from Internet SNAP RCmDestinationExt InternetDestination; TRAPD(err, GetInternetSnapDestinationL(cmManager,InternetDestination )); if (err == KErrNone) { CleanupClosePushL( InternetDestination ); FLOG(_L(" CleanupClosePushL done" )); //SIM provisioned, DM provisioned or user created access point apid = GetInternetSnapLatestAPIDL(InternetDestination); CleanupStack::PopAndDestroy(); // InternetDestination } } CleanupStack::PopAndDestroy(2); //cmManager and db AccessPointItem.Reset(); AccessPointItem2.Reset(); FLOG( _L( "[Provisioning] WPAdapterUtil GetAPIDFromDBorSNAPL: done" ) ); return apid; }
/** Called when async child completes with >=KErrNone */ void CImapOpSyncSubs::DoRunL() { // Finish if any server errors. if (iStatus.Int()!=KErrNone) { Complete(iStatus.Int()); } switch(iNextSyncAction) { case CImapSyncManager::EProcessRemoteSubscription: { // Call returned from the LSUB command. Now process the list. // Update folder tree TInt folderscount = iImapListFolderInfo.Count(); CImapListFolderInfo* folder; for(TInt loop = 0;loop < folderscount; ++loop) { folder = iImapListFolderInfo[loop]; iSyncMan.AddSubscribedFolderFromInfoL(folder, iSession.LogId()); } iSyncMan.CreateLocalFolderListL(); // Now do the remote subscription iNextSyncAction = CImapSyncManager::EUpdateRemoteSubscription; CompleteSelf(); SetActive(); } break; case CImapSyncManager::EUpdateRemoteSubscription: { // Process the subscribed and unsubscribed list from the SyncManager. // This should be done after checking the online subscription list. RArray<TUint>* unsubscribeList = iSyncMan.GetUnSubscribedFolderToDoList(); RArray<TUint>* subscribeList = iSyncMan.GetSubscribedFolderToDoList(); // Any subscription to do? if (subscribeList->Count()) { // Take it off the head TMsvId folderid = (*subscribeList)[0]; subscribeList->Remove(0); // Subscribe to it CImapFolder* tempfolder = iSyncMan.GetTempFolderL(folderid); CleanupStack::PushL(tempfolder); iSession.SubscribeL(iStatus, tempfolder->FullFolderPathL()); CleanupStack::PopAndDestroy(tempfolder); // set the subscribed flag for the folder. SetEntryL(folderid); TMsvEmailEntry entry = iServerEntry.Entry(); entry.SetSubscribed(ETrue); ChangeEntryL(entry); SetActive(); } // ...or unsubscription? else if (unsubscribeList->Count()) { // Take it off the head TMsvId folderid = (*unsubscribeList)[0]; unsubscribeList->Remove(0); // Unsubscribe from it CImapFolder* tempfolder = iSyncMan.GetTempFolderL(folderid); CleanupStack::PushL(tempfolder); iSession.UnsubscribeL(iStatus, tempfolder->FullFolderPathL()); CleanupStack::PopAndDestroy(tempfolder); // clear the subscribed flag for the folder. SetEntryL(folderid); TMsvEmailEntry entry = iServerEntry.Entry(); entry.SetSubscribed(EFalse); ChangeEntryL(entry); SetActive(); } else { // All done. iNextSyncAction = CImapSyncManager::ENotSyncing; Complete(iStatus.Int()); } } break; default: break; } }
// ----------------------------------------------------------------------------- // CLibxml2Tester::TestUseExternalDataL // test deserialize from file, using external data // (other items were commented in a header). // ----------------------------------------------------------------------------- // TInt CLibxml2Tester::TestUseExternalDataInfosetL(CStifItemParser& aItem) { TInt err; TPtrC pDeserializerType; aItem.GetNextString( pDeserializerType ); TPtrC pInputFile; aItem.GetNextString( pInputFile ); TPtrC pBinary; aItem.GetNextString( pBinary ); TPtrC pFile; aItem.GetNextString(pFile); TPtrC pOutputFile; aItem.GetNextString( pOutputFile ); TPtrC pDirtyReturn; aItem.GetNextString( pDirtyReturn ); TLex inputNum (pDirtyReturn); TInt dirtyReturn; inputNum.Val(dirtyReturn); TInt nContainers = 3; RFile fileHandle; RFs aRFs; aRFs.Connect(); CleanupClosePushL( aRFs ); SetupDocumentL(); HBufC8* binbuf = ReadFileToBufferL(pBinary); CleanupStack::PushL(binbuf); TBufC<100> chunkName(_L("ChunkContainer") ); TInt size = 2000; TInt maxSize = 10000; TInt offset = 0; TInt binarySize = CID_2().Length(); // TBool isReadOnly = EFalse; RChunk chunk; chunk.CreateGlobal(chunkName, size, maxSize); CleanupClosePushL(chunk); RFile fp; User::LeaveIfError( fp.Open(aRFs, pFile, EFileRead) ); CleanupClosePushL(fp); TXmlEngBinaryContainer bincont = iDoc.CreateBinaryContainerL(CID_1(), binbuf->Des()); TXmlEngChunkContainer chunkcont = iDoc.CreateChunkContainerL(CID_2(), chunk, offset, binarySize); TXmlEngFileContainer filecont = iDoc.CreateFileContainerL(CID_3(), fp); iDoc.DocumentElement().AppendChildL(bincont); iDoc.DocumentElement().AppendChildL(chunkcont); iDoc.DocumentElement().AppendChildL(filecont); User::LeaveIfError( fileHandle.Replace( aRFs, pOutputFile, EFileStream | EFileWrite | EFileShareExclusive)); CleanupClosePushL( fileHandle ); CTestHandler* testHandle = CTestHandler::NewLC( fileHandle ); RArray<TXmlEngDataContainer> list; CleanupClosePushL(list); //// iDoc.GetDataContainerList(list); CXmlEngDeserializer* des; if( pDeserializerType.FindF( XOP ) != KErrNotFound ) { des = CXmlEngDeserializer::NewL( *testHandle, EDeserializerXOP ); CleanupStack::PushL( des ); des->SetInputFileL( pInputFile ); des->UseExternalDataL( list ); TRAP(err,des->DeserializeL()); } else if( pDeserializerType.FindF( INFOSET ) != KErrNotFound ) { des = CXmlEngDeserializer::NewL( *testHandle, EDeserializerXOPInfoset ); CleanupStack::PushL( des ); des->SetInputFileL( pInputFile ); des->UseExternalDataL( list ); TRAP(err,des->DeserializeL()); } if(list.Count() != nContainers) User::Leave(KErrGeneral); CleanupStack::PopAndDestroy( 8 ); if ( err == dirtyReturn ) return KErrNone; else return err; }
// --------------------------------------------------------------------------- // CAtPhbkEnGetInfo::ParseResponseL // other items were commented in a header // --------------------------------------------------------------------------- void CAtPhbkEnGetInfo::ParseResponseL(const TDesC8& /*aResponseBuf*/) { if( iState==ESetEnStoreComplete ) { if (CurrentLine().Match(KLtsyOkString) == 0) { iError = KErrNone; } else { iError = KErrGeneral; } } else if( iState==EGetEnStoreInfoComplete ) { /** * Here is an Example * +CPBS: "EN",2,16 * phonebooken is selected,2 locations are used and * total 16 locations are available */ iError = KErrNone; RArray<TPtrC8> array; CleanupClosePushL(array); iParser->ParseRespondedBuffer(array,Buffer()); //remove AT+CPBS if(array[0].MatchF(KAnyATCommand)!=KErrNotFound) { array.Remove(0); } TInt count = array.Count(); #ifdef _DEBUG for( TInt i=0;i<count;i++ ) { LOGTEXT3(_L8("CAtPhbkEnGetInfo::ParseResponseL\tarray[%d]=%S"), i,&array[i]); } #endif if (count <= 1) { CleanupStack::PopAndDestroy(); iError = KErrNotFound; return; } if(array[0].MatchF(KCPBSResponseString)==KErrNotFound) { CleanupStack::PopAndDestroy(); iError = KErrNotFound; return; } //parse used TLex8 lex(array[2]); TUint16 val; TInt ret=lex.Val(val,EDecimal); if(ret!=KErrNone) { CleanupStack::PopAndDestroy(); iError = ret; return; } iUsed = val; //parse total TLex8 lex1(array[3]); ret=lex1.Val(val,EDecimal); if(ret!=KErrNone) { CleanupStack::PopAndDestroy(); iError = ret; return; } iTotal = val; LOGTEXT3(_L8("CAtPhbkEnGetInfo::ParseResponseL\tPreferred store used=%d, total=%d"), iUsed,iTotal); CleanupStack::PopAndDestroy(&array); } }
void CSecondThreadApp::TestFileLockL(TInt aError) { TCalTime from; from.SetTimeLocalL(TDateTime(2005, ESeptember, 11, 0, 0, 0, 0)); TCalTime resultTime; // NextInstanceL RDebug::Printf("Test NextInstanceL"); TInt error(KErrNone); TRAP(error, resultTime = iCalTestLib->SynCGetInstanceViewL().NextInstanceL(CalCommon::EIncludeAll, from)); if (error != aError) { User::Leave(KErrGeneral); } // PreviousInstanceL RDebug::Printf("Test PreviousInstanceL"); error = KErrNone; TRAP(error, resultTime = iCalTestLib->SynCGetInstanceViewL().PreviousInstanceL(CalCommon::EIncludeAll, from)); if (error != aError) { User::Leave(KErrGeneral); } // GetIdsModifiedSinceDateL RDebug::Printf("Test GetIdsModifiedSinceDateL"); RArray<TCalLocalUid> uids; CleanupClosePushL(uids); error = KErrNone; TRAP(error, iCalTestLib->SynCGetEntryViewL().GetIdsModifiedSinceDateL(from, uids)); if (error != aError) { User::Leave(KErrGeneral); } if (aError != KErrNone && uids.Count() != 0) { User::Leave(KErrGeneral); } CleanupStack::PopAndDestroy(&uids); // FindInstanceL RDebug::Printf("Test FindInstanceL"); RPointerArray<CCalInstance> instanceList; CleanupResetAndDestroyPushL(instanceList); TCalTime start; start.SetTimeLocalL(TDateTime(2004, EMay, 12, 10, 30, 0, 0)); TCalTime end; end.SetTimeLocalL(TDateTime(2007, EMay, 12, 10, 30, 0, 0)); CalCommon::TCalTimeRange timeRange(start, end); error = KErrNone; TRAP(error, iCalTestLib->SynCGetInstanceViewL().FindInstanceL(instanceList, CalCommon::EIncludeAll, timeRange)); if (error != aError) { User::Leave(KErrGeneral); } if (aError != KErrNone && instanceList.Count() != 0) { User::Leave(KErrGeneral); } CleanupStack::PopAndDestroy(&instanceList); // StoreL RPointerArray<CCalEntry> entryArray; CleanupResetAndDestroyPushL(entryArray); HBufC8* guid = NULL; CCalEntry* entry = iCalTestLib->CreateCalEntryL(CCalEntry::EAppt, guid); CleanupStack::PushL(entry); iCalTestLib->SetEntryStartAndEndTimeL(entry, TDateTime(2005, EMay, 23, 10, 30, 0, 0), TDateTime(2005, EMay, 23, 11, 0, 0, 0)); entryArray.AppendL(entry); CleanupStack::Pop(entry); TInt numSuc; error = KErrNone; TRAP(error, iCalTestLib->SynCGetEntryViewL().StoreL(entryArray, numSuc)); if (error != aError) { User::Leave(KErrGeneral); } // UpdateL error = KErrNone; TRAP(error, iCalTestLib->SynCGetEntryViewL().UpdateL(entryArray, numSuc)); if (error != aError && error != KErrNotFound) { User::Leave(KErrGeneral); } // FetchL error = KErrNone; TRAP(error, iCalTestLib->SynCGetEntryViewL().FetchL(*guid, entryArray)); if (error != aError) { User::Leave(KErrGeneral); } // DeleteL error = KErrNone; TRAP(error, iCalTestLib->SynCGetEntryViewL().DeleteL(*entry)); if (error != aError) { User::Leave(KErrGeneral); } CleanupStack::PopAndDestroy(&entryArray); // CategoryManager CCalCategoryManager* categoryManager = CCalCategoryManager::NewL(iCalTestLib->GetSession()); CleanupStack::PushL(categoryManager); CCalCategory* funCategory = CCalCategory::NewL(_L("Fun")); CleanupStack::PushL(funCategory); error = KErrNone; TRAP(error, categoryManager->AddCategoryL(*funCategory)); if (error != aError) { User::Leave(KErrGeneral); } CleanupStack::PopAndDestroy(funCategory); error = KErrNone; TRAP(error, delete categoryManager->CategoryL(0)); if (error != aError) { User::Leave(KErrGeneral); } CleanupStack::PopAndDestroy(categoryManager); // CCalIter CCalIter* calIter = CCalIter::NewL(iCalTestLib->GetSession()); CleanupStack::PushL(calIter); error = KErrNone; TRAP(error, const TDesC8& guidRefFirst = calIter->FirstL()); if (error != aError) { User::Leave(KErrGeneral); } error = KErrNone; TRAP(error, const TDesC8& guidRefNext = calIter->NextL()); if (error != aError && error != KErrCorrupt) { User::Leave(KErrGeneral); } CleanupStack::PopAndDestroy(calIter); // }
/** 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 CVoIPForm::LoadFormValuesFromDataL() { TInt pageId = ActivePageId(); // Delete all controls not saved. RArray<CEikCaptionedControl*> aControls; ControlsOnPage(aControls, pageId); for (TInt i = 0; i < aControls.Count(); i++) { CEikCaptionedControl* control = ((CEikCaptionedControl*) aControls[i]); DeleteLine(control->iId, EFalse); } aControls.Reset(); // Create controls based on PhoneBook contact item. CVoIPAppUi* iAppUi = static_cast<CVoIPAppUi*> (iEikonEnv->EikAppUi()); CVoIPDocument* iDocument = static_cast<CVoIPDocument*> (iAppUi->Document()); TInt iModifyIndex = iDocument->ModifyIndex(); RPointerArray<CContact> contacts = iAppUi->GetPhoneBook()->GetContactsL(); if (iModifyIndex >= 0) { CContact* contact = contacts[iModifyIndex]; if (contact) { CPbkContactItem* contactItem = iAppUi->GetPhoneBook()->ReadContactItemLC( contact->GetEntryId()); CPbkFieldArray& fieldArray = contactItem->CardFields(); for (TInt i = 0; i < fieldArray.Count(); i++) { TPbkContactItemField field = fieldArray[i]; if (field.IsEmpty() == EFalse) { CPbkFieldInfo& fieldInfo = field.FieldInfo(); TInt id = fieldInfo.FieldId(); TAny* unused = 0; if (fieldInfo.CtrlType() == EPbkFieldCtrlTypeTextEditor) { TInt type = EEikCtEdwin; CEikEdwin * nEditor = static_cast<CEikEdwin*> (ControlOrNull(id)); if (!nEditor) { CEikEdwin* edwin = (CEikEdwin*) CreateLineByTypeL( field.Label(), pageId, id, type, unused); edwin->ConstructL(EEikEdwinNoHorizScrolling | EEikEdwinResizable, 10, 100, 1); edwin->SetTextL(&(field.Text())); } } else if (fieldInfo.CtrlType() == EPbkFieldCtrlTypeNumberEditor) { TInt type = EAknCtIntegerEdwin; CAknNumericEdwin * nEditor = static_cast<CAknNumericEdwin*> (ControlOrNull( id)); if (!nEditor) { CAknNumericEdwin* edwin = (CAknNumericEdwin*) CreateLineByTypeL( field.Label(), pageId, id, type, unused); edwin->ConstructL(EEikEdwinNoHorizScrolling | EEikEdwinResizable, 10, 100, 1); edwin->SetTextL(&(field.Text())); } } else if (fieldInfo.CtrlType() == EPbkFieldCtrlTypeDateEditor) { TInt type = EEikCtDateEditor; CEikDateEditor * nEditor = static_cast<CEikDateEditor*> (ControlOrNull( id)); if (!nEditor) { CEikDateEditor* editor = (CEikDateEditor*) CreateLineByTypeL( field.Label(), pageId, id, type, unused); editor->ConstructL(TTime(mindateTime), TTime( maxdateTime), field.DateTimeStorage()->Time(), ETrue); } Line(id)->ActivateL(); } } } SetChangesPending(ETrue); UpdatePageL(ETrue); CleanupStack::PopAndDestroy(); //contactItem } } }
void CFilteredViewTester::HandleContactViewEvent(const CContactViewBase& aView, const TContactViewEvent& aEvent) { switch (aEvent.iEventType) { case TContactViewEvent::EReady: { if (&aView == iBaseView) { iBaseReady = ETrue; } else if (&aView == iFilteredView) { iFilteredReady = ETrue; } if (iFilteredReady && iBaseReady && iState == ECreateView) { iState = EAddContacts; TRAPD(err, NextTestStepL() ); test(err == KErrNone); } break; } case TContactViewEvent::EItemAdded: { if (&aView == iBaseView) { test.Printf(_L("Add event received: Base view\r\n")); iBaseContactsCount++; } else if (&aView == iFilteredView) { iPosition.AppendL(aEvent.iInt); test.Printf(_L("Add event received: Filtered view\r\n")); iFilteredContactsCount++; } if (iBaseContactsCount == KNumOfContacts && iFilteredContactsCount == KNumOfContacts && iState == EAddContacts) { iState = EDeleteContacts; NextTestStepL(); } break; } case TContactViewEvent::EItemRemoved: { if (&aView == iBaseView) { test.Printf(_L("Remove event received: Base view\r\n")); iBaseContactsCount--; } else if (&aView == iFilteredView) { test.Printf(_L("Remove event received: Filtered view\r\n")); iFilteredContactsCount--; //Verify that deleted contact is the one present in the event received. //The order is not important. TBool found = EFalse; TInt count = iIdArray->Count(); for(TInt loop = 0; loop < count;++loop) { if(aEvent.iContactId == (*iIdArray)[loop]) { found = ETrue; break; } } test(found); //test that the underlying position is within the range of total number of contacts. found = EFalse; count = iPosition.Count(); for(TInt loop = 0; loop < count;++loop) { if(aEvent.iInt == iPosition[loop]) { found = ETrue; break; } } test(found); } if (iBaseContactsCount == 0 && iFilteredContactsCount == 0 && iState == EDeleteContacts) { iState = ETestComplete; NextTestStepL(); } break; } default: { // do nothing... break; } } }
void Syscall::StartNetworkingL(ConnOp& connOp) { LOGST("StartNetworkingL"); DEBUG_ASSERT(gNetworkingState != EStarted); if(gNetworkingState == EStarting) { LOGST("SN pending"); connOp.iStatus = KRequestPending; connOp.SetActive(); gConnOpsWaitingForNetworkingStart.AppendL(&connOp); return; } gNetworkingState = EStarting; LHEL(gConnection.Open(gSocketServ)); TCommDbConnPref pref; #ifdef __SERIES60_3X__ if(gIapMethod == MA_IAP_METHOD_WLAN) { #if 0 // didn't work; prompted anyway. pref.SetBearerSet(KCommDbBearerWLAN); #endif RArray<TUint> iaps; if(gWlanAvailable) { LHEL(gWlanClient->GetAvailableIaps(iaps)); LOG("%i WLAN IAPs available.\n", iaps.Count()); } if(iaps.Count() > 0) { LOG("Picked IAP %i\n", iaps[0]); pref.SetIapId(iaps[0]); pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); } else { LOG("No WLAN IAPs available. Failing...\n"); //connOp.SendResult(CONNERR_NETWORK); connOp.mConn.connErr = CONNERR_NETWORK; //connOp.RunL(); connOp.SetActive(); TRequestStatus* rsp = &connOp.iStatus; User::RequestComplete(rsp, KErrGeneral); return; } } else if(gIapMethod == MA_IAP_METHOD_STANDARD) #endif //__SERIES60_3X__ { bool hasSavedIap = getSavedIap(gIapId); if(hasSavedIap) { LOG("Saved IAP: %u\n", gIapId); pref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt); pref.SetIapId(gIapId); DEBUG_ASSERT(pref.IapId() == gIapId); } else { LOG("No saved IAP, showing dialog...\n"); #ifdef __SERIES60_3X__ if(gIapFilter == MA_IAP_FILTER_NOT_WLAN) { // Note: doesn't work on E61i. WLAN is still displayed. LOG("Not wlan.\n"); pref.SetBearerSet(0xFF & ~KCommDbBearerWLAN); } else if(gIapFilter == MA_IAP_FILTER_WLAN) { LOG("Wlan only.\n"); pref.SetBearerSet(KCommDbBearerWLAN); } else { DEBUG_ASSERT(gIapFilter == MA_IAP_FILTER_ALL); } #endif //__SERIES60_3X__ pref.SetDialogPreference(ECommDbDialogPrefPrompt); } } #ifdef __SERIES60_3X__ else { DEBIG_PHAT_ERROR; } #endif //__SERIES60_3X__ gConnection.Start(pref, connOp.iStatus); connOp.SetActive(); LOGST("SN active"); }
TBool CVoIPForm::SaveFormDataL() { CVoIPAppUi* iAppUi = static_cast<CVoIPAppUi*> (iEikonEnv->EikAppUi()); CVoIPDocument* iDocument = static_cast<CVoIPDocument*> (iAppUi->Document()); TInt iModifyIndex = iDocument->ModifyIndex(); RPointerArray<CContact> contacts = iAppUi->GetPhoneBook()->GetContactsL(); if (iModifyIndex >= 0) { CContact* contact = contacts[iModifyIndex]; if (contact) { iAppUi->GetPhoneBook()->DeleteContactItem(contact->GetEntryId()); TContactItemId contactItemId = iAppUi->GetPhoneBook()->CreateDefaultContactItem(); contact->SetEntryId(contactItemId); CPbkContactItem* contactItem = iAppUi->GetPhoneBook()->OpenContactItemLCX(contactItemId); TInt pageId = ActivePageId(); RArray<CEikCaptionedControl*> aControls; ControlsOnPage(aControls, pageId); for (TInt i = 0; i < aControls.Count(); i++) { CEikCaptionedControl* control = ((CEikCaptionedControl*) aControls[i]); TPbkContactItemField* field = contactItem->FindField( control->iId); if (field == NULL) { CPbkFieldInfo* fieldInfo = iAppUi->GetPhoneBook()->GetFieldsInfo().Find( control->iId); contactItem->AddFieldL(*fieldInfo); field = contactItem->FindField(control->iId); } field->SetLabelL(control->GetFullCaptionText()); CPbkFieldInfo& fieldInfo = field->FieldInfo(); if (fieldInfo.CtrlType() == EPbkFieldCtrlTypeDateEditor) { CEikDateEditor* nEditor = static_cast<CEikDateEditor*> (ControlOrNull( control->iId)); TTime time = nEditor->Date(); field->DateTimeStorage()->SetTime(time); } else { CEikEdwin* nEditor = static_cast<CEikEdwin*> (ControlOrNull( control->iId)); HBufC* text = nEditor->GetTextInHBufL(); field->TextStorage()->SetText(text); } } aControls.Reset(); iAppUi->GetPhoneBook()->CommitContactItem(contactItem); CleanupStack::PopAndDestroy(2); //OpenContactItemLCX } } return ETrue; }
void CThumbnailRetriever::RetrieveThumbnailL( CVideoEntry* aEntry ) { delete iBitmap; iBitmap = NULL; delete iEncoder; iEncoder = NULL; CFlvDemuxer* flv = CFlvDemuxer::NewLC(); TVideoProperties prop; TAny* handle; RArray<TIndexEntry> indices; RPointerArray<void> audioB; RPointerArray<void> videoB; TInt ret = KErrNone; RFile file; TRAPD( err, ret = flv->OpenFileL( aEntry->SavedFileName(), file, indices, prop ) ); if( ret == KErrNone && err == KErrNone ) { handle = VIDEO_Init( prop.iWidth, prop.iHeight, &prop.iVideoExtraData, prop.iVideoExtraDataSize, prop.iVideoCodecId ); if( handle ) { aEntry->SetDuration( prop.iDuration ); if( indices.Count() ) { TInt c = indices.Count() / 2 ; TInt position = indices[c].iPosition - 4; if( position >= flv->FileSize() ) { while( position >= flv->FileSize() ) { c--; position = indices[c].iPosition - 4; if( c == 0 ) break; } } flv->Seek( position); } flv->FillBuffersL( videoB, audioB, CFlvDemuxer::EVideo ); aEntry->SetVideoFileSize( flv->FileSize() ); if( videoB.Count() ) { Packet* pkt = (Packet*)videoB[0]; if( pkt ) { IMAGE *img = (IMAGE *)VIDEO_Decode( handle, pkt->iData, pkt->iSize, 0); if( img ) { iBitmap = new (ELeave) CFbsBitmap; TInt w = prop.iWidth; TInt h = prop.iHeight; w = (w + 1) & (~1); if( h & 1 ) h--; TSize size( w, h ); iBitmap->Create( size, EColor16MU ); TInt scanlineLength = iBitmap->ScanLineLength(iBitmap->SizeInPixels().iWidth, EColor16MU ) / 4; iCC->Init( EColor16MU, CEmTubeYUV2RGB::ERotationNone, CEmTubeYUV2RGB::EScaleNone ); iBitmap->LockHeap( ETrue ); TInt height = img->height; if( height & 1 ) height--; iCC->Convert( img->output, img->width, height, img->stride, img->uv_stride, iBitmap->SizeInPixels().iWidth, iBitmap->SizeInPixels().iHeight, scanlineLength, iBitmap->DataAddress() ); iBitmap->UnlockHeap( ETrue ); iEncoder = CImageEncoder::FileNewL( iFs, aEntry->ThumbnailFile(), _L8("image/jpeg"), CImageEncoder::EOptionNone); iEncoder->Convert( &iStatus, *iBitmap ); SetActive(); iWait.Start(); } } } while( audioB.Count() ) { Packet* pkt = (Packet*)audioB[0]; audioB.Remove( 0 ); flv->FreePacket( pkt ); } while( videoB.Count() ) { Packet* pkt = (Packet*)videoB[0]; videoB.Remove( 0 ); flv->FreePacket( pkt ); } videoB.Close(); audioB.Close(); indices.Close(); VIDEO_Close( handle ); } } flv->CloseFileL(); CleanupStack::PopAndDestroy( flv ); }
void CCmdSetpriority::DoRunL() { LoadMemoryAccessL(); TInt err = KErrNone; // Fix up priorities that we had to make different to kernel cos fshell can't handle negative arguments // See enum TThrdPriority in kern_priv.h for the meaning of these negative numbers switch(iPriority) { case 101: iPriority = -8; break; case 102: iPriority = -7; break; case 103: iPriority = -6; break; case 104: iPriority = -5; break; case 105: iPriority = -4; break; case 106: iPriority = -3; break; case 107: iPriority = -2; break; default: break; } if (iName) { TPtrC8 name8 = iName->Des().Collapse(); LeaveIfErr(iMemAccess.SetPriorityOverride(iPriority, name8), _L("Couldn't set priority override")); iNotifier = new(ELeave) CNewThreadNotifier(*this, iMemAccess); iNotifier->Start(); return; } if (iTids.Count() && iPids.Count()) { LeaveIfErr(KErrArgument, _L("You cannot specify both --tid and --pid - a single priority cannot be valid for thread and process.")); } for (TInt i = 0; i < iTids.Count(); i++) { TUint id = iTids[i]; RThread thread; err = iMemAccess.RThreadForceOpen(thread, id); if (!err) err = iMemAccess.SetThreadPriority(thread, iPriority); if (err) PrintError(err, _L("Couldn't set priority for thread %u"), id); thread.Close(); } for (TInt i = 0; i < iPids.Count(); i++) { TUint id = iPids[i]; // Get KProcessFlagPriorityControl flag RProcess process; err = process.Open(id); LeaveIfErr(err, _L("Couldn't open process with ID %u"), id); TBool priorityControlAllowed = EFalse; TPckg<TProcessKernelInfo> pkg(iProcInfo); err = iMemAccess.GetObjectInfoByHandle(EProcess, RThread().Id(), process.Handle(), pkg); if (err) { PrintWarning(_L("Couldn't get priority control flag setting (%d)\r\n"), err); } else { if (iProcInfo.iFlags & KProcessFlagPriorityControl) priorityControlAllowed = ETrue; } if (!priorityControlAllowed) { PrintError(KErrAccessDenied, _L("This process does not allow setting of its priority")); } else if (iPriority != EPriorityBackground && iPriority != EPriorityForeground) { PrintError(KErrAccessDenied, _L("The kernel will ignore requests to set a process priority that isn't Background (250) or Foreground (350). I can't see how to get round this even using memory access. Sorry.")); } process.SetPriority((TProcessPriority)iPriority); process.Close(); } Complete(KErrNone); }
// --------------------------------------------------------- // CPosTp148::PrintParsedDataFromEncoderL // // (other items were commented in a header). // --------------------------------------------------------- // void CPosTp148::PrintParsedDataFromEncoderL( const TDesC& aFile, const TDesC8& aBuffer, TInt aExpectedStatusCode, const TDesC8& aMimeType) { iLog->Log(_L("===== PrintParsedDataFromEncoderL =======")); iLandmarkParser = CPosLandmarkParser::NewL(aMimeType); if (aFile != KNullDesC) { TFileName file( aFile ); iLog->Log(_L("FILE (%S)"), &file ); TraceL(_L("----->Using FILE<-------")); TraceL(file); iLandmarkParser->SetInputFileL(file); } else { iLog->Log(_L("BUFFER (size %d)"), aBuffer.Size() ); TraceL(_L("----->Using BUFFER<-------")); iLandmarkParser->SetInputBuffer(aBuffer); } iOperation = iLandmarkParser->ParseContentL(); TRequestStatus status = KPosLmOperationNotComplete; TReal32 progress; TInt number = 0; RArray<TPosLmItemId> array; CleanupClosePushL(array); while (status == KPosLmOperationNotComplete) { iLog->Log(_L("--- Parsing ---------------------------")); TraceL(_L("------------------------------")); iOperation->NextStep(status, progress); // Wait for NextStep to complete User::WaitForRequest(status); if (status != KPosLmOperationNotComplete && status != KErrNone) { iLog->Log(_L("Parsing Complete")); HBufC* buffer = HBufC::NewLC( 128); TPtr buf = buffer->Des(); buf.Format(_L("\tStatus %d"), status.Int()); iLog->Log(buf); TraceL(buf); CleanupStack::PopAndDestroy( buffer ); buffer = NULL; } else { iLog->Log(_L("Parsing element")); if ( iLandmarkParser->NumOfParsedLandmarks() ) { // Get last parsed landmark CPosLandmark* lm = iLandmarkParser->LandmarkLC(); TPtrC lmName; TPtrC catName; lm->GetLandmarkName(lmName); lm->GetCategoriesL(array); //iLog->Log(lmName); for (TInt i=0;i<array.Count();i++) { CPosLandmarkCategory* category = iLandmarkParser->LandmarkCategoryLC( array[i] ); category->GetCategoryName( catName ); HBufC* buffer = HBufC::NewLC( 128 + catName.Length()); TPtr buf = buffer->Des(); if ( category->GlobalCategory()) { buf.Append(_L("\tGlobal category: ")); } else { buf.Append(_L("\tLocal category: ")); } buf.Append( catName ); iLog->Log( buf ); TraceL( buf ); CleanupStack::PopAndDestroy( buffer ); buffer = NULL; CleanupStack::PopAndDestroy(category); } PrintLandmarkFieldsWithDescriptionL(*lm, ETrue); number++; CleanupStack::PopAndDestroy(lm); } } } iLog->Log(_L("--- Parsing end ---------------------------")); TraceL(_L("------------------------------")); CleanupStack::PopAndDestroy(&array); if (status.Int() != aExpectedStatusCode) { HBufC* buffer = HBufC::NewLC( 128 ); TPtr buf = buffer->Des(); buf.Format(_L("\tERROR: Wrong status returned, was %d, should be %d"), status.Int(), aExpectedStatusCode); iLog->Log( buf ); iErrorsFound++; CleanupStack::PopAndDestroy( buffer ); buffer = NULL; } TUint32 nr = iLandmarkParser->NumOfParsedLandmarks(); HBufC* buffer = HBufC::NewLC( 256 ); TPtr buf = buffer->Des(); buf.Format(_L("\tNr of Parsed landmarks %d, should be %d"), nr, number); iLog->Log(buf); TraceL(buf); CleanupStack::PopAndDestroy( buffer ); buffer = NULL; if (nr != (TUint32)number) { iLog->Log(_L("\tERROR: Wrong number of landmarks parsed returned!")); iErrorsFound++; } TPosLmCollectionDataId lmId = iLandmarkParser->FirstCollectionDataId(); iLog->Log(_L("--- CollectionData ---")); TraceL(_L("--- CollectionData ---")); if (lmId != EPosLmCollDataNone) { TPtrC first = iLandmarkParser->CollectionData(lmId); HBufC* buffer = HBufC::NewLC( first.Length() + 256 ); TPtr buf = buffer->Des(); buf.Zero(); buf.Format(_L("\t(1)Collection Id: %d CollectionData: "), lmId); buf.Append(first); iLog->Log(buf); TraceL(buf); CleanupStack::PopAndDestroy( buffer ); buffer = NULL; } else { iLog->Log(_L("\tNo collection data found 1")); } while (lmId != EPosLmCollDataNone) { lmId = iLandmarkParser->NextCollectionDataId(lmId); if (lmId != EPosLmCollDataNone) { TPtrC first = iLandmarkParser->CollectionData(lmId); HBufC* buffer = HBufC::NewLC( first.Length() + 256 ); TPtr buf = buffer->Des(); buf.Zero(); buf.Format(_L("\t(2)Collection Id: %d CollectionData: "), lmId); buf.Append(first); iLog->Log(buf); TraceL(buf); CleanupStack::PopAndDestroy( buffer ); buffer = NULL; } else { iLog->Log(_L("\tNo collection data found 2")); } } iLog->Log(_L("--- CollectionData ---")); TraceL(_L("--- CollectionData ---")); delete iOperation; iOperation = NULL; delete iLandmarkParser; iLandmarkParser = NULL; iLog->Log(_L("====== PrintParsedDataFromEncoderL Done ========\n")); }
/** @SYMTestCaseID PDS-SQL-UT-4224 @SYMTestCaseDesc CSqlServer::GetBackUpListL() functional test @SYMTestPriority High @SYMTestActions Calls CSqlServer::GetBackUpListL() and tests the output, when the drive is read-only, when there is a sub-directory which name is matching the search pattern. @SYMTestExpectedResults Test must not fail */ void GetBackupListFunctionalTest() { CSqlServer* server = NULL; TRAPD(err, server = CreateSqlServerL()); TEST2(err, KErrNone); //Case 1: database with specified uid bellow do exist (on drive C). There will be one subdirectory matching the search pattern. const TDriveNumber KTestDrvNum1 = EDriveC; const TUid KDbUid = {0x98765432}; TDriveUnit testDrive(KTestDrvNum1); TDriveName testDriveName = testDrive.Name(); testDriveName.LowerCase(); //One test directory will be created, which name will be matching the search pattern. //The directory name should not be included in the list with the file names. TFileName testFileName; err = server->Fs().PrivatePath(testFileName); TEST2(err, KErrNone); testFileName.Append(KDbUid.Name()); _LIT(KTestPath, "t_startup\\"); testFileName.Append(KTestPath); testFileName.Append(_L("t_startup.db")); TParse parse; err = parse.Set(testFileName, &testDriveName, 0); TEST2(err, KErrNone); err = server->Fs().MkDirAll(parse.FullName()); TEST(err == KErrNone || err == KErrAlreadyExists); // RArray<HBufC*> files; TRAP(err, server->GetBackUpListL(KDbUid, KTestDrvNum1, files)); TEST2(err, KErrNone); TInt fileCnt = files.Count(); for(TInt i=0;i<fileCnt;++i) { TPtrC fname = files[i]->Des(); TheTest.Printf(_L("Db: %S\r\n"), &fname); TEST(fname.FindF(KTestPath) < 0); //The name should include the full path + the drive err = parse.Set(fname, 0, 0); TEST2(err, KErrNone); TEST(parse.DrivePresent()); TEST(parse.PathPresent()); TDriveName driveName(parse.Drive()); driveName.LowerCase(); delete files[i]; TEST(driveName == testDriveName); } files.Close(); //Case 2: drive Z:. No files should be returned. const TDriveNumber KTestDrvNum2 = EDriveZ; TRAP(err, server->GetBackUpListL(KDbUid, KTestDrvNum2, files)); TEST2(err, KErrNone); fileCnt = files.Count(); TEST2(fileCnt, 0); //Case 3: drive A:. The drive does not exist. No files should be returned. const TDriveNumber KTestDrvNum3 = EDriveA; TRAP(err, server->GetBackUpListL(KDbUid, KTestDrvNum3, files)); TheTest.Printf(_L("Drive %d, err=%d\r\n"), KTestDrvNum3, err); fileCnt = files.Count(); TEST2(fileCnt, 0); // delete server; }
// ------------------------------------------------ // 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 ); }