mpxplugins/viewplugins/views/metadataeditordialog/src/mpxmetadataeditordialog.cpp
branchRCL_3
changeset 14 c54d95799c80
parent 13 c8156a91d13c
child 17 70a8526f03f2
--- a/mpxplugins/viewplugins/views/metadataeditordialog/src/mpxmetadataeditordialog.cpp	Wed Mar 31 21:26:33 2010 +0300
+++ b/mpxplugins/viewplugins/views/metadataeditordialog/src/mpxmetadataeditordialog.cpp	Wed Apr 14 15:54:18 2010 +0300
@@ -75,7 +75,7 @@
 #include "mpxmetadataeditordialog.hlp.hrh"
 #include "mpxlog.h"
 #include <drmuihandling.h>
-
+#include <mpxplaybackutility.h>
 
 // CONSTANTS
 const TInt KMPXFileDetailsMaxTitleLen = 32;
@@ -489,7 +489,7 @@
 
     iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault );
     iCommonUiHelper = CMPXCommonUiHelper::NewL();
-
+    
     CAknForm::ConstructL( R_MPX_CUI_SONG_DETAILS_MENUBAR );
 
     iCurrentLibrary = EMPXMetadataEditorDlgCollection;
@@ -2455,10 +2455,11 @@
     	KMPXSongDetailsYearMin, KMPXSongDetailsYearMax );
 
     // Get media property for the current song
-    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
-    CleanupStack::PushL( cpath );
-    if ( iParam )
+    
+    if ( iParam ) // Dialog launched from CollectionView
         {
+		CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+        CleanupStack::PushL( cpath );
         TLex yearLex( iParam->Des() );
         TInt lexToInt = NULL;
         if ( yearLex.Val( lexToInt ) == KErrNone )
@@ -2479,8 +2480,33 @@
             iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
             CleanupStack::PopAndDestroy( &attrs );
             }
+		CleanupStack::PopAndDestroy( cpath );	
         }
-    CleanupStack::PopAndDestroy( cpath );
+    else // Dialog launched from NowPlayingView
+        {
+        // Get the playback utility instance from engine.
+        MMPXPlaybackUtility* playbackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+        MMPXSource* s = playbackUtility->Source();
+        if ( s )
+            {
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            attrs.Append( KMPXMediaGeneralAll );
+            attrs.Append( KMPXMediaAudioAudioAll );
+            attrs.Append( KMPXMediaMusicAll );
+            attrs.Append( KMPXMediaDrmProtected );
+            if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast )
+                {
+                 attrs.Append(
+                      TMPXAttribute( KMPXMediaIdPodcast, EMPXMediaPodcastAll ) );
+                }
+                iCurrentMediaLOp = EMPXMetadataEditorGetSongInfo;
+                s->MediaL(attrs.Array(), *this);
+                CleanupStack::PopAndDestroy( &attrs );
+            }  
+        playbackUtility->Close();
+        }
+    
 
     // Podcasting is enabled
     if ( !iDisablePodcasting )
@@ -3147,4 +3173,47 @@
     CleanupStack::PopAndDestroy( &drmFile );
     CleanupStack::PopAndDestroy( &fs );
     }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::HandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::HandleSubPlayerNamesL" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Method is called continously until aComplete=ETrue, signifying that
+// it is done and there will be no more callbacks
+// Only new items are passed each time
+// ---------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::HandleSubPlayerNamesL(
+    TUid /* aPlayer */,
+    const MDesCArray* /* aSubPlayers */,
+    TBool /* aComplete */,
+    TInt /* aError */ )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::HandleSubPlayerNamesL" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media properties.
+// Notes: The client is responsible for delete the object of aMedia.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::HandleMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::HandleMediaL" );
+    TRAP_IGNORE( DoHandleMediaL( aMedia, aError ) );
+    }
 // End of File