serviceproviders/sapi_mediamanagement/tsrc/testing/performance/s60_perf/src/mgservice.cpp
changeset 22 fc9cf246af83
parent 19 989d2f495d90
equal deleted inserted replaced
19:989d2f495d90 22:fc9cf246af83
    66 	{
    66 	{
    67     //release iEngine;
    67     //release iEngine;
    68     delete iEngine;
    68     delete iEngine;
    69 
    69 
    70     //release filter class
    70     //release filter class
    71     delete iFilter;
    71     //delete iFilter;
    72 
    72 
    73     // release sorting style
    73     // release sorting style
    74     delete iSortingStyle;
    74    // delete iSortingStyle;
    75 
    75 
    76 	// release clf observer class
    76 	// release clf observer class
    77 
    77 
    78     delete iClfObserver;
    78    // delete iClfObserver;
    79     
    79     
    80 
    80 
    81 	}
    81 	}
    82 
    82 
    83 
    83 
   210 // -----------------------------------------------------------------------------
   210 // -----------------------------------------------------------------------------
   211 
   211 
   212 void CMgService::SetSortingFieldL(const TDesC8& aSortField ,
   212 void CMgService::SetSortingFieldL(const TDesC8& aSortField ,
   213 								  const TDesC8&  aOrder ,
   213 								  const TDesC8&  aOrder ,
   214 								  const RArray<TInt>& aMediaTypes,
   214 								  const RArray<TInt>& aMediaTypes,
   215 								  MCLFItemListModel* alistModel )
   215 								  MCLFItemListModel* alistModel ,
       
   216 								  MCLFSortingStyle* aSortingStyle )
   216 	{
   217 	{
   217 
   218 
   218 	// Default sorting as per file name
   219 	// Default sorting as per file name
   219 	TCLFDefaultFieldId metaDataId = ECLFFieldIdFileName;
   220 	TCLFDefaultFieldId metaDataId = ECLFFieldIdFileName;
   220     TCLFItemDataType  metaDataType = ECLFItemDataTypeDesC;
   221     TCLFItemDataType  metaDataType = ECLFItemDataTypeDesC;
   234 	 	    {
   235 	 	    {
   235 	 	    // The given Sort Field  is not supported by Media Management SAPI
   236 	 	    // The given Sort Field  is not supported by Media Management SAPI
   236 	 		User::Leave( KErrArgument );
   237 	 		User::Leave( KErrArgument );
   237 	 		}
   238 	 		}
   238     	}
   239     	}
   239 
   240    	aSortingStyle->ResetL();
   240 	iSortingStyle->ResetL();
   241 	//iSortingStyle->ResetL();
   241 
   242 
   242 
   243 
   243  	//Set the field on which sorting has to perform
   244  	//Set the field on which sorting has to perform
   244 	iSortingStyle->AddFieldL( metaDataId );
   245    	aSortingStyle->AddFieldL( metaDataId );
       
   246    	//iSortingStyle->AddFieldL( metaDataId );
   245 
   247 
   246 	// Set the sorting field data type
   248 	// Set the sorting field data type
   247 	iSortingStyle->SetSortingDataType( metaDataType );
   249    	aSortingStyle->SetSortingDataType( metaDataType );
       
   250 	//iSortingStyle->SetSortingDataType( metaDataType );
   248 
   251 
   249 	if( 0 == aOrder.CompareF( KMgDescending ) )
   252 	if( 0 == aOrder.CompareF( KMgDescending ) )
   250 		{
   253 		{
   251 		iSortingStyle->SetOrdering( ECLFOrderingDescending  );
   254 		
       
   255 		aSortingStyle->SetOrdering( ECLFOrderingDescending  );
       
   256 		//iSortingStyle->SetOrdering( ECLFOrderingDescending  );
   252 		}
   257 		}
   253 	else
   258 	else
   254 		{
   259 		{
   255 		iSortingStyle->SetOrdering( ECLFOrderingAscending );
   260 		aSortingStyle->SetOrdering( ECLFOrderingAscending   );
       
   261 		//iSortingStyle->SetOrdering( ECLFOrderingAscending );
   256 		}
   262 		}
   257 
   263 
   258 	//Items with undefined fields are placed after items with defined fields
   264 	//Items with undefined fields are placed after items with defined fields
   259 	iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
   265 	aSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
       
   266 	//iSortingStyle->SetUndefinedItemPosition( ECLFSortingStyleUndefinedEnd );
   260 
   267 
   261 	// set sorting style in CLF.
   268 	// set sorting style in CLF.
   262 	alistModel->SetSortingStyle( iSortingStyle );
   269 	alistModel->SetSortingStyle( aSortingStyle );
   263 
   270 
   264 
   271 
   265 	}
   272 	}
   266 
   273 
   267 
   274 
   271 // -----------------------------------------------------------------------------
   278 // -----------------------------------------------------------------------------
   272 void CMgService::SetFilterMetaDataL( const TDesC8& aFilterField,
   279 void CMgService::SetFilterMetaDataL( const TDesC8& aFilterField,
   273 									 const TDesC& aStartVal,
   280 									 const TDesC& aStartVal,
   274 									 const TDesC& aEndVal,
   281 									 const TDesC& aEndVal,
   275 									 const RArray<TInt>& aMediaTypes, 
   282 									 const RArray<TInt>& aMediaTypes, 
   276 									 MCLFItemListModel* alistModel )
   283 									 MCLFItemListModel* alistModel,
       
   284 									 CPostFilter* aFilter)
   277 	{
   285 	{
   278 	TCLFDefaultFieldId metaDataId;
   286 	TCLFDefaultFieldId metaDataId;
   279     TCLFItemDataType  metaDataType;
   287     TCLFItemDataType  metaDataType;
   280     
   288     
   281 
   289 
   284     // no filtration will be performed
   292     // no filtration will be performed
   285     if( 0 == aFilterField.CompareF( KNullDesC8 ) )
   293     if( 0 == aFilterField.CompareF( KNullDesC8 ) )
   286     	{
   294     	{
   287        	metaDataId = ECLFFieldIdNull;
   295        	metaDataId = ECLFFieldIdNull;
   288        	metaDataType = ECLFItemDataTypeDesC;	// Blank Descriptor
   296        	metaDataType = ECLFItemDataTypeDesC;	// Blank Descriptor
   289         iFilter->SetFilterMetaData( metaDataId, metaDataType );
   297        	aFilter->SetFilterMetaData( metaDataId, metaDataType );
       
   298         //iFilter->SetFilterMetaData( metaDataId, metaDataType );
   290    		}
   299    		}
   291     else
   300     else
   292     	{
   301     	{
   293     	GetMetaDataIdAndType( aFilterField,
   302     	GetMetaDataIdAndType( aFilterField,
   294     						  metaDataId,
   303     						  metaDataId,
   299 	 		{
   308 	 		{
   300 	 		// The given metaData is not supported by Media Management SAPI
   309 	 		// The given metaData is not supported by Media Management SAPI
   301 	 		User::Leave( KErrNotSupported );
   310 	 		User::Leave( KErrNotSupported );
   302 	 		}
   311 	 		}
   303 
   312 
   304 
   313 	 	aFilter->SetFilterMetaData( metaDataId, metaDataType );
   305 	 	iFilter->SetFilterMetaData( metaDataId, metaDataType );
   314 	 	//iFilter->SetFilterMetaData( metaDataId, metaDataType );
   306 
   315 
   307        	// set filter value of CLF
   316        	// set filter value of CLF
   308 	    iFilter->SetFilterValueL( aStartVal,aEndVal );
   317 	 	aFilter->SetFilterValueL( aStartVal,aEndVal );
       
   318 	    //iFilter->SetFilterValueL( aStartVal,aEndVal );
   309 
   319 
   310 		// Set Post Filter in CLF
   320 		// Set Post Filter in CLF
   311 	    alistModel->SetPostFilter( iFilter );
   321 	    alistModel->SetPostFilter( aFilter );
   312 
   322 
   313 	 	}
   323 	 	}
   314 
   324 
   315   	}
   325   	}
   316 
   326 
   326 	iEngine = ContentListingFactory::NewContentListingEngineLC();
   336 	iEngine = ContentListingFactory::NewContentListingEngineLC();
   327     CleanupStack::Pop();
   337     CleanupStack::Pop();
   328 
   338 
   329 
   339 
   330     // create the instance of CPostFilter and store it in member data
   340     // create the instance of CPostFilter and store it in member data
   331     iFilter = CPostFilter::NewL();
   341 //    iFilter = CPostFilter::NewL();
   332 
   342 
   333     // Get the sorting style from CLF
   343     // Get the sorting style from CLF
   334 	iSortingStyle = ContentListingFactory::NewSortingStyleLC();
   344 //	iSortingStyle = ContentListingFactory::NewSortingStyleLC();
   335  	CleanupStack::Pop();
   345  //	CleanupStack::Pop();
   336 
   346 
   337  	//create the instance of clf observer
   347  	//create the instance of clf observer
   338  	iClfObserver = CClfOperationObserver::NewL();
   348  //	iClfObserver = CClfOperationObserver::NewL();
   339 
   349 
   340 	}
   350 	}
   341 
   351 
   342 
   352 
   343 
   353 
   347 // Constructor
   357 // Constructor
   348 // -----------------------------------------------------------------------------
   358 // -----------------------------------------------------------------------------
   349 CMgService::CMgService()
   359 CMgService::CMgService()
   350           : iState( EMgFree ),
   360           : iState( EMgFree ),
   351             iEngine( NULL ),
   361             iEngine( NULL ),
   352 			iFilter( NULL ),
       
   353 			iSortingStyle( NULL ),
       
   354 			iClfObserver( NULL ),
       
   355 			iTransactionID( 0 )
   362 			iTransactionID( 0 )
   356 	{
   363 	{
   357 
   364 
   358 	}
   365 	}
   359 
   366 
   416 								    const TDesC8& aFilterField,
   423 								    const TDesC8& aFilterField,
   417                 				    const TDesC&  aStartVal,
   424                 				    const TDesC&  aStartVal,
   418                 				    const TDesC&  aEndVal,
   425                 				    const TDesC&  aEndVal,
   419                 				    const TDesC8& aSortField,
   426                 				    const TDesC8& aSortField,
   420                 				    const TDesC8&  aOrder,
   427                 				    const TDesC8&  aOrder,
   421                 				    MCLFItemListModel* alistModel )
   428                 				    MCLFItemListModel* alistModel ,
       
   429                 				    CPostFilter* aFilter,
       
   430                 				    MCLFSortingStyle* aSortingStyle)
   422     {
   431     {
   423 
   432 
   424 
   433 
   425 
   434 
   426 	RArray<TInt> mediaTypes;
   435 	RArray<TInt> mediaTypes;
   433 	//set wanted media type in CLF
   442 	//set wanted media type in CLF
   434 	alistModel->SetWantedMediaTypesL( mediaTypes.Array() );
   443 	alistModel->SetWantedMediaTypesL( mediaTypes.Array() );
   435 
   444 
   436 
   445 
   437 	// Set Filter Meta Data  and Value
   446 	// Set Filter Meta Data  and Value
   438     SetFilterMetaDataL( aFilterField,aStartVal,aEndVal,mediaTypes,alistModel);
   447     SetFilterMetaDataL( aFilterField,aStartVal,aEndVal,mediaTypes,alistModel,aFilter);
   439     
   448     
   440 
   449 
   441 
   450 
   442     // call set sorting field of CLF
   451     // call set sorting field of CLF
   443     SetSortingFieldL( aSortField,aOrder,mediaTypes,alistModel );
   452     SetSortingFieldL( aSortField,aOrder,mediaTypes,alistModel, aSortingStyle);
   444    
   453    
   445  	// set the state = Busy
   454  	// set the state = Busy
   446  	// till this request is complete
   455  	// till this request is complete
   447  	//which indicates no further request will be taken
   456  	//which indicates no further request will be taken
   448  	iState = EMgBusy;
   457  	iState = EMgBusy;