mpxplugins/viewplugins/views/metadataeditordialog/src/mpxmetadataeditordialog.cpp
branchRCL_3
changeset 14 c54d95799c80
parent 13 c8156a91d13c
child 17 70a8526f03f2
equal deleted inserted replaced
13:c8156a91d13c 14:c54d95799c80
    73 #include "mpxmetadataeditordialog.h"
    73 #include "mpxmetadataeditordialog.h"
    74 #include "mpxmetadataeditordialog.hrh"
    74 #include "mpxmetadataeditordialog.hrh"
    75 #include "mpxmetadataeditordialog.hlp.hrh"
    75 #include "mpxmetadataeditordialog.hlp.hrh"
    76 #include "mpxlog.h"
    76 #include "mpxlog.h"
    77 #include <drmuihandling.h>
    77 #include <drmuihandling.h>
    78 
    78 #include <mpxplaybackutility.h>
    79 
    79 
    80 // CONSTANTS
    80 // CONSTANTS
    81 const TInt KMPXFileDetailsMaxTitleLen = 32;
    81 const TInt KMPXFileDetailsMaxTitleLen = 32;
    82 const TInt KMPXFileDetailsMaxBufferLen = 255;
    82 const TInt KMPXFileDetailsMaxBufferLen = 255;
    83 const TInt KMPXMinNumDateTrack = 0;
    83 const TInt KMPXMinNumDateTrack = 0;
   487     TRAPD(drmResourceError,iDrmResourceOffset = coeEnv->AddResourceFileL( drmResourceFile ));
   487     TRAPD(drmResourceError,iDrmResourceOffset = coeEnv->AddResourceFileL( drmResourceFile ));
   488     iDrmDetails = (drmResourceError == KErrNone) ? ETrue: EFalse;
   488     iDrmDetails = (drmResourceError == KErrNone) ? ETrue: EFalse;
   489 
   489 
   490     iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault );
   490     iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault );
   491     iCommonUiHelper = CMPXCommonUiHelper::NewL();
   491     iCommonUiHelper = CMPXCommonUiHelper::NewL();
   492 
   492     
   493     CAknForm::ConstructL( R_MPX_CUI_SONG_DETAILS_MENUBAR );
   493     CAknForm::ConstructL( R_MPX_CUI_SONG_DETAILS_MENUBAR );
   494 
   494 
   495     iCurrentLibrary = EMPXMetadataEditorDlgCollection;
   495     iCurrentLibrary = EMPXMetadataEditorDlgCollection;
   496     // check if it's podcast collection
   496     // check if it's podcast collection
   497     CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
   497     CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
  2453 
  2453 
  2454     SetControlNumberL ( EMPXMetadataEditorDlgCtrlIdYear, KZero,
  2454     SetControlNumberL ( EMPXMetadataEditorDlgCtrlIdYear, KZero,
  2455     	KMPXSongDetailsYearMin, KMPXSongDetailsYearMax );
  2455     	KMPXSongDetailsYearMin, KMPXSongDetailsYearMax );
  2456 
  2456 
  2457     // Get media property for the current song
  2457     // Get media property for the current song
  2458     CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
  2458     
  2459     CleanupStack::PushL( cpath );
  2459     if ( iParam ) // Dialog launched from CollectionView
  2460     if ( iParam )
  2460         {
  2461         {
  2461 		CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
       
  2462         CleanupStack::PushL( cpath );
  2462         TLex yearLex( iParam->Des() );
  2463         TLex yearLex( iParam->Des() );
  2463         TInt lexToInt = NULL;
  2464         TInt lexToInt = NULL;
  2464         if ( yearLex.Val( lexToInt ) == KErrNone )
  2465         if ( yearLex.Val( lexToInt ) == KErrNone )
  2465             {
  2466             {
  2466             cpath->Set( lexToInt );
  2467             cpath->Set( lexToInt );
  2477                 }
  2478                 }
  2478             iCurrentMediaLOp = EMPXMetadataEditorGetSongInfo;
  2479             iCurrentMediaLOp = EMPXMetadataEditorGetSongInfo;
  2479             iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
  2480             iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
  2480             CleanupStack::PopAndDestroy( &attrs );
  2481             CleanupStack::PopAndDestroy( &attrs );
  2481             }
  2482             }
  2482         }
  2483 		CleanupStack::PopAndDestroy( cpath );	
  2483     CleanupStack::PopAndDestroy( cpath );
  2484         }
       
  2485     else // Dialog launched from NowPlayingView
       
  2486         {
       
  2487         // Get the playback utility instance from engine.
       
  2488         MMPXPlaybackUtility* playbackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
       
  2489         MMPXSource* s = playbackUtility->Source();
       
  2490         if ( s )
       
  2491             {
       
  2492             RArray<TMPXAttribute> attrs;
       
  2493             CleanupClosePushL(attrs);
       
  2494             attrs.Append( KMPXMediaGeneralAll );
       
  2495             attrs.Append( KMPXMediaAudioAudioAll );
       
  2496             attrs.Append( KMPXMediaMusicAll );
       
  2497             attrs.Append( KMPXMediaDrmProtected );
       
  2498             if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast )
       
  2499                 {
       
  2500                  attrs.Append(
       
  2501                       TMPXAttribute( KMPXMediaIdPodcast, EMPXMediaPodcastAll ) );
       
  2502                 }
       
  2503                 iCurrentMediaLOp = EMPXMetadataEditorGetSongInfo;
       
  2504                 s->MediaL(attrs.Array(), *this);
       
  2505                 CleanupStack::PopAndDestroy( &attrs );
       
  2506             }  
       
  2507         playbackUtility->Close();
       
  2508         }
       
  2509     
  2484 
  2510 
  2485     // Podcasting is enabled
  2511     // Podcasting is enabled
  2486     if ( !iDisablePodcasting )
  2512     if ( !iDisablePodcasting )
  2487         {
  2513         {
  2488         iPopup = static_cast<CAknPopupField*>
  2514         iPopup = static_cast<CAknPopupField*>
  3145     CleanupClosePushL( drmFile );
  3171     CleanupClosePushL( drmFile );
  3146     iDrmUiHandler->ShowDetailsViewL( drmFile );
  3172     iDrmUiHandler->ShowDetailsViewL( drmFile );
  3147     CleanupStack::PopAndDestroy( &drmFile );
  3173     CleanupStack::PopAndDestroy( &drmFile );
  3148     CleanupStack::PopAndDestroy( &fs );
  3174     CleanupStack::PopAndDestroy( &fs );
  3149     }
  3175     }
       
  3176 
       
  3177 // ---------------------------------------------------------------------------
       
  3178 // From MMPXPlaybackCallback
       
  3179 // Handle playback property.
       
  3180 // ---------------------------------------------------------------------------
       
  3181 //
       
  3182 void CMPXMetadataEditorDialog::HandlePropertyL(
       
  3183     TMPXPlaybackProperty aProperty,
       
  3184     TInt aValue,
       
  3185     TInt aError )
       
  3186     {
       
  3187     MPX_FUNC( "CMPXMetadataEditorDialog::HandleSubPlayerNamesL" );
       
  3188     }
       
  3189 
       
  3190 // ---------------------------------------------------------------------------
       
  3191 // From MMPXPlaybackCallback
       
  3192 // Method is called continously until aComplete=ETrue, signifying that
       
  3193 // it is done and there will be no more callbacks
       
  3194 // Only new items are passed each time
       
  3195 // ---------------------------------------------------------------------------
       
  3196 //
       
  3197 void CMPXMetadataEditorDialog::HandleSubPlayerNamesL(
       
  3198     TUid /* aPlayer */,
       
  3199     const MDesCArray* /* aSubPlayers */,
       
  3200     TBool /* aComplete */,
       
  3201     TInt /* aError */ )
       
  3202     {
       
  3203     MPX_FUNC( "CMPXMetadataEditorDialog::HandleSubPlayerNamesL" );
       
  3204     }
       
  3205 
       
  3206 // ---------------------------------------------------------------------------
       
  3207 // From MMPXPlaybackCallback
       
  3208 // Handle media properties.
       
  3209 // Notes: The client is responsible for delete the object of aMedia.
       
  3210 // ---------------------------------------------------------------------------
       
  3211 //
       
  3212 void CMPXMetadataEditorDialog::HandleMediaL(
       
  3213     const CMPXMedia& aMedia,
       
  3214     TInt aError )
       
  3215     {
       
  3216     MPX_FUNC( "CMPXMetadataEditorDialog::HandleMediaL" );
       
  3217     TRAP_IGNORE( DoHandleMediaL( aMedia, aError ) );
       
  3218     }
  3150 // End of File
  3219 // End of File