diff -r 3ec52facab4d -r 8192e5b5c935 mpviewplugins/mpcollectionviewplugin/src/mpcollectioncontainerplaylists.cpp --- a/mpviewplugins/mpcollectionviewplugin/src/mpcollectioncontainerplaylists.cpp Fri May 14 15:49:53 2010 +0300 +++ b/mpviewplugins/mpcollectionviewplugin/src/mpcollectioncontainerplaylists.cpp Thu May 27 12:49:57 2010 +0300 @@ -23,6 +23,7 @@ #include #include "mpcollectioncontainerplaylists.h" +#include "mpcollectiondatamodel.h" #include "mpmpxcollectiondata.h" #include "mptrace.h" @@ -48,9 +49,12 @@ */ MpCollectionContainerPlaylists::MpCollectionContainerPlaylists( HbDocumentLoader *loader, QGraphicsItem *parent ) : MpCollectionListContainer(loader, parent), - mInfoBar(0) + mInfoBar(0), + mCurrentPlaylistIndex(0) { TX_LOG + mCollectionContext = ECollectionContextPlaylists; + } /*! @@ -65,6 +69,51 @@ } /*! + Sets the data model for the container. + */ +void MpCollectionContainerPlaylists::setDataModel( MpCollectionDataModel *dataModel ) +{ + TX_ENTRY + MpCollectionListContainer::setDataModel(dataModel); + if ( mCollectionContext == ECollectionContextPlaylists ) { + if ( mList ) { + if ( mCollectionData->count() ) { + mList->scrollTo( dataModel->index(mCurrentPlaylistIndex, 0) ); + } + } + } + TX_EXIT +} + +/*! + Slot to be called when an item is selected by the user. +*/ +void MpCollectionContainerPlaylists::itemActivated( const QModelIndex &index ) +{ + if ( mCollectionContext == ECollectionContextPlaylists ) { + mCurrentPlaylistIndex = index.row(); + TX_ENTRY_ARGS("mCurrentPlaylistIndex=" << mCurrentPlaylistIndex); + } + MpCollectionListContainer::itemActivated(index); + TX_EXIT +} + +/*! + Slot to be called data model has new data. + */ +void MpCollectionContainerPlaylists::dataReloaded() +{ + TX_ENTRY + MpCollectionListContainer::dataReloaded(); + if ( mCollectionContext == ECollectionContextPlaylistSongs ) { + // Playlist could have been renamed. + QString details = mCollectionData->collectionTitle(); + mInfoBar->setHeading(details); + } + TX_EXIT +} + +/*! Sets up the container by organizing widgets according to its layout. \reimp @@ -103,7 +152,7 @@ QString details; if ( mViewMode == MpCommon::FetchView ) { - details = "Select a song"; + details = hbTrId("txt_mus_subtitle_select_a_song"); } else { details = mCollectionData->collectionTitle();