profilesservices/MediaFileList/Src/mediafilehandler.cpp
branchRCL_3
changeset 26 e78c61e77b1a
parent 25 7e0eff37aedb
equal deleted inserted replaced
25:7e0eff37aedb 26:e78c61e77b1a
  2884 // -----------------------------------------------------------------------------
  2884 // -----------------------------------------------------------------------------
  2885 //
  2885 //
  2886 CSearchList::~CSearchList()
  2886 CSearchList::~CSearchList()
  2887     {
  2887     {
  2888     iList.ResetAndDestroy();
  2888     iList.ResetAndDestroy();
       
  2889     iList.Close();
  2889     delete iDriveUtil;
  2890     delete iDriveUtil;
  2890     }
  2891     }
  2891 
  2892 
  2892 
  2893 
  2893 // -----------------------------------------------------------------------------
  2894 // -----------------------------------------------------------------------------
  2999         }
  3000         }
  3000     TInt error = KErrNone;
  3001     TInt error = KErrNone;
  3001     TInt count = aQuery->Count( 0 );    
  3002     TInt count = aQuery->Count( 0 );    
  3002     for( int i = 0; i< count; i++ )
  3003     for( int i = 0; i< count; i++ )
  3003     	{
  3004     	{
  3004         CSearchListItem* item = CSearchListItem::NewL();
  3005         CSearchListItem* item = CSearchListItem::NewLC();
  3005         error = aQuery->RomFileItem( item, i );
  3006         error = aQuery->RomFileItem( item, i );
  3006         if ( error == KErrNone )
  3007         if ( error == KErrNone )
  3007         	{
  3008         	{
  3008             TPtrC title = item->Title();
  3009             TPtrC title = item->Title();
  3009             TInt rt = title.FindF( aSearchText );
  3010             TInt rt = title.FindF( aSearchText );
  3010             if ( rt != KErrNotFound )
  3011             if ( rt != KErrNotFound )
  3011             	{
  3012             	{
  3012             	iList.AppendL( item );
  3013             	iList.AppendL( item );
       
  3014                 CleanupStack::Pop( item );
  3013             	}
  3015             	}
       
  3016             else
       
  3017                 {
       
  3018                 CleanupStack::PopAndDestroy( item );
       
  3019                 }
       
  3020             }
       
  3021         else
       
  3022             {
       
  3023             CleanupStack::PopAndDestroy( item );
  3014         	}
  3024         	}
  3015     	}
  3025     	}
  3016     }
  3026     }
  3017 
  3027 
  3018 // -----------------------------------------------------------------------------
  3028 // -----------------------------------------------------------------------------
  3028         }
  3038         }
  3029     TInt error = KErrNone;
  3039     TInt error = KErrNone;
  3030     TInt count = aQuery->Count( 1 );    
  3040     TInt count = aQuery->Count( 1 );    
  3031     for( int i = 0; i< count; i++ )
  3041     for( int i = 0; i< count; i++ )
  3032         {
  3042         {
  3033         CSearchListItem* item = CSearchListItem::NewL();
  3043         CSearchListItem* item = CSearchListItem::NewLC();
  3034         error = aQuery->RomVedioItem( item, i );
  3044         error = aQuery->RomVedioItem( item, i );
  3035         if ( error == KErrNone )
  3045         if ( error == KErrNone )
  3036             {
  3046             {
  3037             TPtrC title = item->Title();
  3047             TPtrC title = item->Title();
  3038             TInt rt = title.FindF( aSearchText );
  3048             TInt rt = title.FindF( aSearchText );
  3039             if ( rt != KErrNotFound )
  3049             if ( rt != KErrNotFound )
  3040                 {
  3050                 {
  3041                 iList.AppendL( item );
  3051                 iList.AppendL( item );
       
  3052                 CleanupStack::Pop( item );
  3042                 }
  3053                 }
       
  3054             else
       
  3055                 {
       
  3056                 CleanupStack::PopAndDestroy( item );
       
  3057                 }
       
  3058             }
       
  3059         else
       
  3060             {
       
  3061             CleanupStack::PopAndDestroy( item );
  3043             }
  3062             }
  3044         }
  3063         }
  3045     }
  3064     }
  3046 // -----------------------------------------------------------------------------
  3065 // -----------------------------------------------------------------------------
  3047 // CSearchList::TakeArtistResultL
  3066 // CSearchList::TakeArtistResultL
  3161     if ( aMediaType == CMediaFileHandler::EMediaTypeTone )
  3180     if ( aMediaType == CMediaFileHandler::EMediaTypeTone )
  3162         {
  3181         {
  3163         count = aRomList->Count( 0 );
  3182         count = aRomList->Count( 0 );
  3164         for ( TInt i=0; i< count; i++ )
  3183         for ( TInt i=0; i< count; i++ )
  3165             {
  3184             {
  3166             CSearchListItem* item = CSearchListItem::NewL();
  3185             CSearchListItem* item = CSearchListItem::NewLC();
  3167             error = aRomList->RomFileItem( item, i );
  3186             error = aRomList->RomFileItem( item, i );
  3168             if ( error == KErrNone )
  3187             if ( error == KErrNone )
  3169                 {
  3188                 {
  3170                 iList.AppendL( item );
  3189                 iList.AppendL( item );
       
  3190                 CleanupStack::Pop( item );
       
  3191                 }
       
  3192             else
       
  3193                 {
       
  3194                 CleanupStack::PopAndDestroy( item );
  3171                 }
  3195                 }
  3172             }
  3196             }
  3173         }
  3197         }
  3174     else if ( aMediaType == CMediaFileHandler::EMediaTypeVideo )
  3198     else if ( aMediaType == CMediaFileHandler::EMediaTypeVideo )
  3175         {
  3199         {
  3176         count = aRomList->Count( 1 );
  3200         count = aRomList->Count( 1 );
  3177         for (TInt i = 0; i < count; i++)
  3201         for (TInt i = 0; i < count; i++)
  3178             {
  3202             {
  3179             CSearchListItem* item = CSearchListItem::NewL();
  3203             CSearchListItem* item = CSearchListItem::NewLC();
  3180             error = aRomList->RomVedioItem(item, i);
  3204             error = aRomList->RomVedioItem(item, i);
  3181             if (error == KErrNone)
  3205             if (error == KErrNone)
  3182                 {
  3206                 {
  3183                 iList.AppendL(item);
  3207                 iList.AppendL(item);
       
  3208                 CleanupStack::Pop( item );
       
  3209                 }
       
  3210             else
       
  3211                 {
       
  3212                 CleanupStack::PopAndDestroy( item );
  3184                 }
  3213                 }
  3185             }
  3214             }
  3186         }
  3215         }
  3187 
  3216 
  3188     }
  3217     }