mpengine/src/mpmpxcollectionframeworkwrapper_p.cpp
changeset 32 c163ef0b758d
parent 29 8192e5b5c935
child 37 eb79a7c355bf
--- a/mpengine/src/mpmpxcollectionframeworkwrapper_p.cpp	Thu May 27 12:49:57 2010 +0300
+++ b/mpengine/src/mpmpxcollectionframeworkwrapper_p.cpp	Fri Jun 11 13:36:36 2010 +0300
@@ -81,7 +81,8 @@
       iUserPlaylists( 0 ),
       iRepeatFeature( ETrue ),
       iShuffleFeature( ETrue ),
-      iReopen( EFalse )
+      iReopen( EFalse ),
+      iShuffleAll( EFalse )
 {
     TX_LOG
 }
@@ -365,6 +366,22 @@
 
 /*!
  \internal
+ */
+void MpMpxCollectionFrameworkWrapperPrivate::openShuffleAllSongsPath()
+{
+    TX_ENTRY
+    TRAPD( err, DoOpenCollectionL(ECollectionContextAllSongs) );
+    if ( err != KErrNone ) {
+        TX_LOG_ARGS( "Error: " << err << "; should never get here." );
+    }
+    else {
+        iShuffleAll = ETrue; 
+    }
+    TX_EXIT
+}
+
+/*!
+ \internal
  Result of open or re-open operation to the Collection Framework.
  */
 void MpMpxCollectionFrameworkWrapperPrivate::HandleOpenL( 
@@ -378,8 +395,14 @@
     TX_ENTRY_ARGS( "aError=" << aError << "aComplete=" << aComplete );
     if ( aError == KErrNone ) {
         if ( iFirstIncrementalOpen ) {
+            iFirstIncrementalOpen = EFalse;
+            if( iShuffleAll ) {
+                iShuffleAll = EFalse;
+                TX_ENTRY_ARGS( "Path is ready" );
+                DoPlayAllSongsPlaylistL();
+                
+            }
             iCollectionData->setMpxMedia( aEntries, iReopen );
-            iFirstIncrementalOpen = EFalse;
             iReopen = EFalse;
         }
     }
@@ -1253,4 +1276,24 @@
     }
 }
 
+/*!
+ \internal
+ */
+void MpMpxCollectionFrameworkWrapperPrivate::DoPlayAllSongsPlaylistL()
+{
+    TX_ENTRY
+    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+    CleanupStack::PushL( cpath );
+    CMPXCollectionPlaylist* playList = CMPXCollectionPlaylist::NewL( *cpath );
+    CleanupStack::PushL( playList );
+    playList->SetShuffleL( true, false );
+    MpSettingsManager::setShuffle( true );
+    createPlaybackUtilityL();
+    iPlaybackUtility->InitL( *playList, ETrue );
+    CleanupStack::PopAndDestroy( playList );
+    CleanupStack::PopAndDestroy( cpath );
+    TX_EXIT
+}
+
+
 //EOF