filedetails/filedetailsplugin/src/filedetailsplugin.cpp
branchRCL_3
changeset 9 5294c000a26d
parent 0 96612d01cf9f
equal deleted inserted replaced
8:ce5ada96ab30 9:5294c000a26d
    58 // -----------------------------------------------------------------------------
    58 // -----------------------------------------------------------------------------
    59 // CFileDetailsPlugin::~CFileDetailsPlugin
    59 // CFileDetailsPlugin::~CFileDetailsPlugin
    60 //
    60 //
    61 // -----------------------------------------------------------------------------
    61 // -----------------------------------------------------------------------------
    62 //  
    62 //  
    63 void CFileDetailsPlugin::ShowFileDetails( const CMPXMedia& aMedia )
    63 void CFileDetailsPlugin::ShowFileDetailsL( const CMPXMedia& aMedia )
    64     {  
    64     {  
    65     CMPFileDetailsDialog* detailsDialog = CMPFileDetailsDialog::NewL(); 
       
    66     CMPFileDetails* details = new (ELeave) CMPFileDetails();
    65     CMPFileDetails* details = new (ELeave) CMPFileDetails();
       
    66     CleanupStack::PushL( details );
    67     
    67     
    68     //File path    
    68     //File path    
    69     if ( aMedia.IsSupported( KMPXMediaGeneralUri ) )
    69     if ( aMedia.IsSupported( KMPXMediaGeneralUri ) )
    70         {
    70         {
    71         details->iFilePath = aMedia.ValueText( KMPXMediaGeneralUri ).AllocLC();                
    71         details->iFilePath = aMedia.ValueText( KMPXMediaGeneralUri ).AllocL();                
    72         }
    72         }
    73     
    73     
    74     //Name    
    74     //Name    
    75     if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) )
    75     if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) )
    76         {
    76         {
    77         details->iTitle = aMedia.ValueText( KMPXMediaGeneralTitle ).AllocLC();                
    77         details->iTitle = aMedia.ValueText( KMPXMediaGeneralTitle ).AllocL();                
    78         }
    78         }
    79     else if ( details->iFilePath )
    79     else if ( details->iFilePath )
    80         {
    80         {
    81         details->iTitle = details->iFilePath->AllocLC();
    81         details->iTitle = details->iFilePath->AllocLC();
    82         }
    82         }
    98        }
    98        }
    99     
    99     
   100     //Copyright
   100     //Copyright
   101     if ( aMedia.IsSupported( KMPXMediaGeneralCopyright ) )
   101     if ( aMedia.IsSupported( KMPXMediaGeneralCopyright ) )
   102         {
   102         {
   103         details->iCopyright = aMedia.ValueText( KMPXMediaGeneralCopyright ).AllocLC();        
   103         details->iCopyright = aMedia.ValueText( KMPXMediaGeneralCopyright ).AllocL();        
   104         }
   104         }
   105     
   105     
   106     //MIME
   106     //MIME
   107     if ( aMedia.IsSupported( KMPXMediaGeneralMimeType ) )
   107     if ( aMedia.IsSupported( KMPXMediaGeneralMimeType ) )
   108         {
   108         {
   109         details->iFormat = aMedia.ValueText( KMPXMediaGeneralMimeType ).AllocLC();        
   109         details->iFormat = aMedia.ValueText( KMPXMediaGeneralMimeType ).AllocL();        
   110         }
   110         }
   111     
   111     
   112     // File creation date
   112     // File creation date
   113     if ( aMedia.IsSupported( KMPXMediaGeneralDate ) )
   113     if ( aMedia.IsSupported( KMPXMediaGeneralDate ) )
   114         {        
   114         {        
   136         }
   136         }
   137     
   137     
   138     //Artist    
   138     //Artist    
   139    if ( aMedia.IsSupported( KMPXMediaVideoArtist ) )
   139    if ( aMedia.IsSupported( KMPXMediaVideoArtist ) )
   140        {
   140        {
   141        details->iArtist = aMedia.ValueText( KMPXMediaVideoArtist ).AllocLC();                
   141        details->iArtist = aMedia.ValueText( KMPXMediaVideoArtist ).AllocL();                
   142        } 
   142        } 
   143              
   143 
       
   144     // Show details dialog
       
   145     CMPFileDetailsDialog* detailsDialog = CMPFileDetailsDialog::NewL(); 
   144     detailsDialog->ExecuteLD( details );
   146     detailsDialog->ExecuteLD( details );
   145     
   147 
   146     // cleanup
   148     CleanupStack::PopAndDestroy( details );
   147     if( details->iFormat )
       
   148         {
       
   149         CleanupStack::PopAndDestroy( details->iFormat );
       
   150         details->iFormat = NULL;
       
   151         }    
       
   152     if( details->iCopyright )
       
   153         {
       
   154         CleanupStack::PopAndDestroy( details->iCopyright );
       
   155         details->iCopyright = NULL;
       
   156         }
       
   157     if( details->iTitle )
       
   158         {
       
   159         CleanupStack::PopAndDestroy( details->iTitle );
       
   160         details->iTitle = NULL;
       
   161         }
       
   162     if( details->iFilePath )
       
   163         {
       
   164         CleanupStack::PopAndDestroy( details->iFilePath );
       
   165         details->iFilePath = NULL;
       
   166         }   
       
   167   
       
   168     delete details;
       
   169     }
   149     }