profilesservices/MediaFileList/Src/mediafiledialog.cpp
branchRCL_3
changeset 23 8bda91a87a00
parent 18 854ebc17f64b
equal deleted inserted replaced
22:673fb3e04649 23:8bda91a87a00
  1334 
  1334 
  1335     if ( folderId == KErrNotFound )
  1335     if ( folderId == KErrNotFound )
  1336         {
  1336         {
  1337         // user has selected some media file
  1337         // user has selected some media file
  1338 	    GetSelectedItemFileName( currentIndex, iBuf );
  1338 	    GetSelectedItemFileName( currentIndex, iBuf );
  1339 	    
       
  1340 	    TBool ret = ETrue;
       
  1341 	    
  1339 	    
  1342 	    // protection check not done when item is double checked
  1340 	    // protection check not done when item is double checked
  1343 	   // if ( aAttr != EAttrDoubleClicked )
  1341 	   // if ( aAttr != EAttrDoubleClicked )
  1344 	   if (!ifilevalid)
  1342 	   if (!ifilevalid)
  1345 	        {
  1343 	        {
  2178     TRAP_IGNORE( DoUpdateListBoxL( aRestFindBox ) );
  2176     TRAP_IGNORE( DoUpdateListBoxL( aRestFindBox ) );
  2179     
  2177     
  2180     iListBox->MakeVisible( ETrue );
  2178     iListBox->MakeVisible( ETrue );
  2181     }
  2179     }
  2182 
  2180 
       
  2181 // ----------------------------------------------------------------------------
       
  2182 // CMediaFileDialog::FilterInvalidFiles
       
  2183 // 
       
  2184 // Filters the invalid files from media file handler
       
  2185 // invalid files = rights expired DRM Protected files and no right files
       
  2186 // ----------------------------------------------------------------------------
       
  2187 //
       
  2188 void CMediaFileDialog::FilterInvalidFiles()
       
  2189     {
       
  2190     TInt count = iMediaFileHandler->ResultCount();
       
  2191     
       
  2192     for ( TInt idx = 0; idx < count; )
       
  2193         {
       
  2194         // check the validity
       
  2195         GetSelectedItemFileName( idx, iBuf );
       
  2196         if ( iProtectionHandler->IsFlieDRMExpired( iBuf ) )
       
  2197             {
       
  2198             // remove the item from handler in case of invalid file
       
  2199             iMediaFileHandler->Remove( idx );
       
  2200             
       
  2201             // if an item was removed from handler, the idx will not 
       
  2202             // be changed and the count will be decreased one. after 
       
  2203             // recalculate the count, the next item will be checked in next loop.
       
  2204             count = iMediaFileHandler->ResultCount();
       
  2205             }
       
  2206         else
       
  2207             {
       
  2208             // just increase the idx in case of valid file
       
  2209             idx++;
       
  2210             }
       
  2211         }
       
  2212     }
  2183 
  2213 
  2184 // ----------------------------------------------------------------------------
  2214 // ----------------------------------------------------------------------------
  2185 // CMediaFileDialog::DoUpdateListBoxL
  2215 // CMediaFileDialog::DoUpdateListBoxL
  2186 // 
  2216 // 
  2187 // Update listbox contents (currently open folder items).
  2217 // Update listbox contents (currently open folder items).
  2188 // ----------------------------------------------------------------------------
  2218 // ----------------------------------------------------------------------------
  2189 //
  2219 //
  2190 void CMediaFileDialog::DoUpdateListBoxL( TBool aRestFindBox )
  2220 void CMediaFileDialog::DoUpdateListBoxL( TBool aRestFindBox )
  2191     {
  2221     {
       
  2222     // filter the invalid files to avoid showing in the list box
       
  2223     FilterInvalidFiles();
  2192     iState->SetUnknownFolderPosition( iMediaFileHandler->ResultCount() );
  2224     iState->SetUnknownFolderPosition( iMediaFileHandler->ResultCount() );
  2193     
  2225     
  2194     // check current item index in case media file database has changed
  2226     // check current item index in case media file database has changed
  2195     CheckListboxIndex();
  2227     CheckListboxIndex();
  2196     if ( aRestFindBox )
  2228     if ( aRestFindBox )