mpserviceplugins/mpxsqlitedbhgplugin/src/mpxdbcategory.cpp
changeset 25 3ec52facab4d
parent 22 ecf06a08d4d9
child 51 560ce2306a17
equal deleted inserted replaced
22:ecf06a08d4d9 25:3ec52facab4d
   187             CleanupStack::PopAndDestroy(critStr);
   187             CleanupStack::PopAndDestroy(critStr);
   188             }
   188             }
   189         else if (criterion == KMPXMediaGeneralTitle)
   189         else if (criterion == KMPXMediaGeneralTitle)
   190             {
   190             {
   191 #ifdef RD_MPX_COLLECTION_CACHE
   191 #ifdef RD_MPX_COLLECTION_CACHE
   192            
   192 
   193             if (aCriteria.ValueText(KMPXMediaGeneralTitle).Length() <= 0)
   193             if (aCriteria.ValueText(KMPXMediaGeneralTitle).Length() <= 0)
   194                 {
   194                 {
   195                 TUint32 itemId = MPXDbCommonUtil::GenerateUniqueIdL(
   195                 TUint32 itemId = MPXDbCommonUtil::GenerateUniqueIdL(
   196                                     iDbManager.Fs(), iCategory, KNullDesC, EFalse);
   196                                     iDbManager.Fs(), iCategory, KNullDesC, EFalse);
   197                 HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
   197                 HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
   210 #ifdef RD_MPX_COLLECTION_CACHE
   210 #ifdef RD_MPX_COLLECTION_CACHE
   211                 }
   211                 }
   212 #endif //RD_MPX_COLLECTION_CACHE
   212 #endif //RD_MPX_COLLECTION_CACHE
   213             }
   213             }
   214 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
   214 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
   215           else if (criterion == KMPXMediaGeneralUri)
   215         else if (criterion == KMPXMediaGeneralUri)
   216                  {  
   216             {
   217                  TUint32 itemId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
   217             //only Genre and  AbstractAlbum are not case sensitive
   218                        aCriteria.ValueText(KMPXMediaGeneralUri), (iCategory != EMPXGenre)));   
   218             TBool caseSensitive = ETrue;            
   219                    HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
   219             if ((iCategory == EMPXGenre) || (iCategory == EMPXAbstractAlbum))
   220                    MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, *critStr, itemId);
   220                  caseSensitive = EFalse;
   221              CleanupStack::PopAndDestroy(critStr);
   221                       
   222              }
   222             TUint32 itemId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
       
   223                  aCriteria.ValueText(KMPXMediaGeneralUri), caseSensitive));   
       
   224             HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
       
   225             MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, *critStr, itemId);
       
   226             CleanupStack::PopAndDestroy(critStr);
       
   227             }
   223         else if (criterion == KMPXMediaGeneralDrive)
   228         else if (criterion == KMPXMediaGeneralDrive)
   224             {
   229             {
   225             const TDesC& drive(aCriteria.ValueText(KMPXMediaGeneralDrive));
   230             const TDesC& drive(aCriteria.ValueText(KMPXMediaGeneralDrive));
   226             TDriveUnit driveUnit(drive);
   231             TDriveUnit driveUnit(drive);
   227             MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionAbstractAlbumVolumeId,
   232             MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionAbstractAlbumVolumeId,
   255 //
   260 //
   256 void CMPXDbCategory::DecrementSongsForCategoryL(
   261 void CMPXDbCategory::DecrementSongsForCategoryL(
   257     const TUint32 aId,
   262     const TUint32 aId,
   258     TInt aDriveId,
   263     TInt aDriveId,
   259     CMPXMessageArray* aItemChangedMessages,
   264     CMPXMessageArray* aItemChangedMessages,
   260     TBool& aItemExist,
   265     TBool& aItemExist
   261     TBool /*aMTPInUse*/)
   266 #ifdef ABSTRACTAUDIOALBUM_INCLUDED
       
   267     ,
       
   268     TBool /*aMTPInUse*/
       
   269 #endif //ABSTRACTAUDIOALBUM_INCLUDED
       
   270 )
   262     {
   271     {
   263     MPX_FUNC("CMPXDbCategory::DecrementSongsForCategoryL");
   272     MPX_FUNC("CMPXDbCategory::DecrementSongsForCategoryL");
   264 
   273 
   265     // if just one song uses this category. Use <= just in case
   274     // if just one song uses this category. Use <= just in case
   266     if (GetSongsCountL(aDriveId, aId) <= 1)
   275     if (GetSongsCountL(aDriveId, aId) <= 1)
   470 
   479 
   471     return ret;
   480     return ret;
   472     }
   481     }
   473 
   482 
   474 void CMPXDbCategory::UpdateItemL(
   483 void CMPXDbCategory::UpdateItemL(
   475     TUint32 /*aId*/, 
   484     TUint32 /*aId*/,
   476     const CMPXMedia& /*aMedia*/, 
   485     const CMPXMedia& /*aMedia*/,
   477     TInt /*aDriveId*/, 
   486     TInt /*aDriveId*/,
   478     CMPXMessageArray* /*aItemChangedMessages*/)
   487     CMPXMessageArray* /*aItemChangedMessages*/)
   479 	{
   488 	{
   480 	// nothing
   489 	// nothing
   481 	}
   490 	}
   482 
   491